Skip to content

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

TSN218 - Bug when add new Tag (#997)

Stanimir161ae173c5b0
diff --git a/app/reducers/app.js b/app/reducers/app.js
index 19a9b7c7a..6461877ef 100644
--- a/app/reducers/app.js
+++ b/app/reducers/app.js
@@ -1046,48 +1046,46 @@ export const actions = {
},
renameFile: (filePath: string, newFilePath: string) => (
dispatch: (actions: Object) => void
- ) => {
- PlatformIO.renameFilePromise(filePath, newFilePath)
- .then(() => {
- // console.log('File renamed ' + filePath + ' to ' + newFilePath);
+ ) => PlatformIO.renameFilePromise(filePath, newFilePath)
+ .then(() => {
+ // console.log('File renamed ' + filePath + ' to ' + newFilePath);
+ dispatch(
+ actions.showNotification(
+ i18n.t('core:renamingSuccessfully'),
+ 'default',
+ true
+ )
+ );
+ // Update sidecar file and thumb
+ renameFilesPromise([
+ [getMetaFileLocationForFile(filePath), getMetaFileLocationForFile(newFilePath)],
+ [getThumbFileLocationForFile(filePath), getThumbFileLocationForFile(newFilePath)]
+ ]).then(() => {
+ console.log('Renaming meta file and thumb successful for ' + filePath);
dispatch(actions.reflectRenameEntry(filePath, newFilePath));
- // UI notification
- dispatch(
- actions.showNotification(
- i18n.t('core:renamingSuccessfully'),
- 'default',
- true
- )
- );
- // Update sidecar file and thumb
- renameFilesPromise([
- [getMetaFileLocationForFile(filePath), getMetaFileLocationForFile(newFilePath)],
- [getThumbFileLocationForFile(filePath), getThumbFileLocationForFile(newFilePath)]
- ]).then(() => {
- console.log('Renaming meta file and thumb successful for ' + filePath);
- return true;
- }).catch((err) => {
- console.warn('Renaming meta file and thumb failed with ' + err);
- });
return true;
- })
- .catch(error => {
- console.warn('Error while renaming file: ' + error);
- dispatch(
- actions.showNotification(
- `Error while renaming file ${filePath}`,
- 'error',
- true
- )
- );
+ }).catch((err) => {
+ dispatch(actions.reflectRenameEntry(filePath, newFilePath));
+ console.warn('Renaming meta file and thumb failed with ' + err);
});
- },
+ return true;
+ })
+ .catch(error => {
+ console.warn('Error while renaming file: ' + error);
+ dispatch(
+ actions.showNotification(
+ `Error while renaming file ${filePath}`,
+ 'error',
+ true
+ )
+ );
+ }),
openFileNatively: (selectedFile: string) => () => {
PlatformIO.openFile(selectedFile);
},
saveFile: () => (
- dispatch: (actions: Object) => void,
- getState: () => Object
+ // dispatch: (actions: Object) => void,
+ // getState: () => Object
) => {
actions.showNotification(i18n.t('core:notImplementedYet'), 'warning', true);
// const { app } = getState();