Deleting a file will now delete its downloaded thumbnail as well

Thumbnails will now have their permissions auto updated to align themselves with the other downloaded files
This commit is contained in:
Isaac Grynsztein
2020-06-30 22:38:01 -04:00
parent efdc471ccf
commit 5537852134
4 changed files with 63 additions and 6 deletions

View File

@@ -195,10 +195,12 @@ async function deleteSubscriptionFile(sub, file, deleteForever, file_uid = null,
var jsonPath = path.join(__dirname,filePath,name+'.info.json');
var videoFilePath = path.join(__dirname,filePath,name+ext);
var imageFilePath = path.join(__dirname,filePath,name+'.jpg');
var altImageFilePath = path.join(__dirname,filePath,name+'.jpg');
jsonExists = fs.existsSync(jsonPath);
videoFileExists = fs.existsSync(videoFilePath);
imageFileExists = fs.existsSync(imageFilePath);
altImageFileExists = fs.existsSync(altImageFilePath);
if (jsonExists) {
retrievedID = JSON.parse(fs.readFileSync(jsonPath, 'utf8'))['id'];
@@ -209,6 +211,10 @@ async function deleteSubscriptionFile(sub, file, deleteForever, file_uid = null,
fs.unlinkSync(imageFilePath);
}
if (altImageFileExists) {
fs.unlinkSync(altImageFilePath);
}
if (videoFileExists) {
fs.unlink(videoFilePath, function(err) {
if (fs.existsSync(jsonPath) || fs.existsSync(videoFilePath)) {