Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

fix broken file renaming for file names with dot

Sendil Kumara8db2b30f20a
diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx
index 632c685b..8c32336c 100644
--- a/src/components/App/index.tsx
+++ b/src/components/App/index.tsx
@@ -107,7 +107,7 @@ async function compressImage(
return new File(
[compressedData],
- sourceFilename.replace(/\..+$/, '.' + encoder.extension),
+ sourceFilename.replace(/.[^.]*$/, `.${encoder.extension}`),
{ type: encoder.mimeType },
);
}