Skip to content

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

chore: fix path issue on Windows

Ilian Sapundshiev9e0ca3ccc58e
diff --git a/src/renderer/components/dialogs/DownloadUrlDialog.tsx b/src/renderer/components/dialogs/DownloadUrlDialog.tsx
index 6a3a4690a..f19c5c7dd 100644
--- a/src/renderer/components/dialogs/DownloadUrlDialog.tsx
+++ b/src/renderer/components/dialogs/DownloadUrlDialog.tsx
@@ -372,15 +372,19 @@ function DownloadUrlDialog(props: Props) {
const baseName =
sanitizeDownloadFileName(fileName) ||
`download${extForFormat(saveFormat, originalExt)}`;
+ const dirSeparator = currentLocation?.getDirSeparator() || '/';
const finalName = generateFileName(
baseName,
tagTitles,
tagDelimiter,
- currentLocation?.getDirSeparator(),
+ dirSeparator,
prefixTagContainer,
filenameTagPlacedAtEnd,
);
- const targetPath = `${targetDirectoryPath}/${finalName}`;
+ // Join with the location's separator (not a hardcoded `/`): on Windows local
+ // `targetDirectoryPath` uses `\`, and a mixed-separator path breaks the
+ // post-download reflect/add match so the new file wouldn't appear.
+ const targetPath = `${targetDirectoryPath}${dirSeparator}${finalName}`;
const reflectOpen = (entry: TS.FileSystemEntry) => {
setReflectActions({