From 118e8387db88aa31baee37168f5b45e945cbaf6b Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 27 Oct 2024 03:25:26 -0400 Subject: [PATCH] FixFileExtensions When Anon Temp Disabled --- src/plugins/anonymiseFileNames/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/anonymiseFileNames/index.tsx b/src/plugins/anonymiseFileNames/index.tsx index fbc99848..5e17e5c3 100644 --- a/src/plugins/anonymiseFileNames/index.tsx +++ b/src/plugins/anonymiseFileNames/index.tsx @@ -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: