mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 17:46:16 +01:00
fix: handle ENOENT on file deletion, closes #10645
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
"strip-exif-data": "Strip EXIF Data",
|
||||
"preserve-orphaned-uploads": "Keep uploaded files on disk after a post is purged",
|
||||
"orphanExpiryDays": "Days to keep orphaned files",
|
||||
"orphanExpiryDays-help": "After this many days, orphaned uploads will be deleted from the file system.<br />Set 0 or leave blank to disable.",
|
||||
"private-extensions": "File extensions to make private",
|
||||
"private-uploads-extensions-help": "Enter comma-separated list of file extensions to make private here (e.g. <code>pdf,xls,doc</code>). An empty list means all files are private.",
|
||||
"resize-image-width-threshold": "Resize images if they are wider than specified width",
|
||||
|
||||
@@ -107,6 +107,11 @@ file.delete = async function (path) {
|
||||
try {
|
||||
await fs.promises.unlink(path);
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
winston.verbose(`[file] Attempted to delete non-existent file: ${path}`);
|
||||
return;
|
||||
}
|
||||
|
||||
winston.warn(err);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -135,9 +135,10 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="orphanExpiryDays">[[admin/settings/uploads:orphanExpiryDays]]</label>
|
||||
<input id="orphanExpiryDays" type="number" min="0" placeholder="0 to disable" class="form-control" data-field="orphanExpiryDays" />
|
||||
<input id="orphanExpiryDays" type="number" min="0" placeholder="0" class="form-control" data-field="orphanExpiryDays" />
|
||||
<p class="help-block">[[admin/settings/uploads:orphanExpiryDays-help]]</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user