Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

feat: warn on mismatched file type

JovannMC47bb2aab843c
diff --git a/messages/en.json b/messages/en.json
index ba1fd79..4152838 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -429,7 +429,8 @@
"file_too_large": "This file exceeds the {limit}GB browser / device limit. Try Firefox or Safari to convert this large file, which typically have higher limits."
},
"warnings": {
- "settings_change": "Changed setting '{setting}' from '{oldValue}' to '{newValue}' for {file} ({to}) to prevent conversion failure."
+ "settings_change": "Changed setting '{setting}' from '{oldValue}' to '{newValue}' for {file} ({to}) to prevent conversion failure.",
+ "file_type_mismatch": "File {filename} is named {expected}, but was detected as {actual}. This may cause conversion issues."
}
},
"privacy": {
diff --git a/src/lib/types/file.svelte.ts b/src/lib/types/file.svelte.ts
index 2888635..7887dba 100644
--- a/src/lib/types/file.svelte.ts
+++ b/src/lib/types/file.svelte.ts
@@ -189,7 +189,15 @@ export class VertFile {
console.warn(
`file type mismatched: expected ${expectedExtension}, detected ${detectedExtension}`,
);
- // TODO: show a warning modal or message if detected type doesn't match name
+ ToastManager.add({
+ type: "warning",
+ disappearing: false,
+ message: m["workers.warnings.file_type_mismatch"]({
+ filename: this.file.name,
+ expected: expectedExtension,
+ actual: detectedExtension,
+ }),
+ });
}
this.from = `.${detectedExtension}`;
@@ -290,6 +298,7 @@ export class VertFile {
oldValue: change.oldValue,
newValue: change.newValue,
file: change.file,
+ to: this.to,
}),
});
}