FixFileExtensions When Anon Temp Disabled

This commit is contained in:
thororen1234 2024-10-27 03:25:26 -04:00
parent f2c2246d1e
commit 118e8387db

View file

@ -114,15 +114,16 @@ export default definePlugin({
}, { noop: true }),
anonymise(upload: AnonUpload) {
if ((upload.anonymise ?? settings.store.anonymiseByDefault) === false) return upload.filename;
const file = upload.filename;
const tarMatch = tarExtMatcher.exec(file);
const extIdx = tarMatch?.index ?? file.lastIndexOf(".");
const fileName = extIdx !== -1 ? file.substring(0, extIdx) : "";
let ext = extIdx !== -1 ? file.slice(extIdx) : "";
if (Settings.plugins.FixFileExtensions.enabled) {
ext = reverseExtensionMap[ext];
}
if ((upload.anonymise ?? settings.store.anonymiseByDefault) === false) return fileName + ext;
switch (settings.store.method) {
case Methods.Random: