Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: correct the file path in the confirmation dialog for external file opening

Ilian Sapundshiev5c7ab527bd03
diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.ts
index 0847971ce..b2ef9b3f4 100644
--- a/src/renderer/services/utils-io.ts
+++ b/src/renderer/services/utils-io.ts
@@ -1085,10 +1085,24 @@ export function openFileMessage(
filePath: string,
warningOpeningFilesExternally: boolean,
): void {
+ // Decode for display only — the raw filePath is still sent to Electron below.
+ let displayPath = filePath;
+ try {
+ displayPath = decodeURIComponent(filePath);
+ } catch (ex) {
+ // keep the original path if it is not a valid encoded URI
+ }
if (
!warningOpeningFilesExternally ||
// eslint-disable-next-line no-restricted-globals
- confirm(i18n.t('core:confirmOpenFile', { path: filePath }))
+ confirm(
+ // Native confirm() renders plain text, so disable i18next HTML escaping
+ // (otherwise path separators show up as / etc.).
+ i18n.t('core:confirmOpenFile', {
+ path: displayPath,
+ interpolation: { escapeValue: false },
+ }),
+ )
) {
if (AppConfig.isElectron) {
window.electronIO.ipcRenderer.sendMessage('openFile', filePath);