mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-20 06:29:32 +02:00
chore: move from png to image-generic
This commit is contained in:
@@ -52,8 +52,17 @@ export default function ToolFileResult({
|
||||
if (value) {
|
||||
let filename: string = value.name;
|
||||
if (extension) {
|
||||
const hasExtension = filename.includes('.');
|
||||
filename = hasExtension ? filename : `${filename}.${extension}`;
|
||||
// Split at the last period to separate filename and extension
|
||||
const parts = filename.split('.');
|
||||
// If there's more than one part (meaning there was a period)
|
||||
if (parts.length > 1) {
|
||||
// Remove the last part (the extension) and add the new extension
|
||||
parts.pop();
|
||||
filename = `${parts.join('.')}.${extension}`;
|
||||
} else {
|
||||
// No extension exists, just add it
|
||||
filename = `${filename}.${extension}`;
|
||||
}
|
||||
}
|
||||
const blob = new Blob([value], { type: value.type });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
Reference in New Issue
Block a user