aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/anonymiseFileNames.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/anonymiseFileNames.ts')
-rw-r--r--src/plugins/anonymiseFileNames.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/anonymiseFileNames.ts b/src/plugins/anonymiseFileNames.ts
index 5bae10a..c7c3ed5 100644
--- a/src/plugins/anonymiseFileNames.ts
+++ b/src/plugins/anonymiseFileNames.ts
@@ -67,7 +67,9 @@ export default definePlugin({
anonymise(file: string) {
let name = "image";
- const ext = file.match(/\..+$/g)?.[0] ?? "";
+ const extIdx = file.lastIndexOf(".");
+ const ext = extIdx !== -1 ? file.slice(extIdx) : "";
+
switch (Settings.plugins.AnonymiseFileNames.method) {
case Methods.Random:
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";