AnonymiseFileNames: Properly keep .tar.* extensions

This commit is contained in:
V 2023-08-12 02:45:11 +02:00
parent 742f5cf556
commit fe80b8cc85
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -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) {