aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/anonymiseFileNames.ts
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-09 17:30:37 +0100
committerVendicated <vendicated@riseup.net>2022-11-09 17:30:48 +0100
commite0450531efa84c42e4857b78176f5e80de2ab12e (patch)
treedbf6849f623c4b86bb2bff2efd6295095e6f7fc1 /src/plugins/anonymiseFileNames.ts
parentb032e9b6e30c456d0a569faa6ea962315822edb2 (diff)
downloadVencord-e0450531efa84c42e4857b78176f5e80de2ab12e.tar.gz
Vencord-e0450531efa84c42e4857b78176f5e80de2ab12e.tar.bz2
Vencord-e0450531efa84c42e4857b78176f5e80de2ab12e.zip
StickerSpoof: fix small resolutions; AnonymiseFiles: fix extension logic
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";