From fe80b8cc8586f3119076a99c610f36d7824985a9 Mon Sep 17 00:00:00 2001 From: V Date: Sat, 12 Aug 2023 02:45:11 +0200 Subject: AnonymiseFileNames: Properly keep .tar.* extensions --- src/plugins/anonymiseFileNames.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/anonymiseFileNames.ts b/src/plugins/anonymiseFileNames.ts index 37fd18f..9e69d7a 100644 --- a/src/plugins/anonymiseFileNames.ts +++ b/src/plugins/anonymiseFileNames.ts @@ -26,6 +26,8 @@ const enum Methods { Timestamp, } +const tarExtMatcher = /\.tar\.\w+$/; + export default definePlugin({ name: "AnonymiseFileNames", authors: [Devs.obscurity], @@ -67,7 +69,8 @@ export default definePlugin({ anonymise(file: string) { let name = "image"; - const extIdx = file.lastIndexOf("."); + const tarMatch = tarExtMatcher.exec(file); + const extIdx = tarMatch?.index ?? file.lastIndexOf("."); const ext = extIdx !== -1 ? file.slice(extIdx) : ""; switch (Settings.plugins.AnonymiseFileNames.method) { -- cgit