TagSpaces is an offline, open source, document manager with tagging support
fix Extension Installation Broken on Windows and sidecar tags (#1905)
Stanimir315108462e4a
diff --git a/app/components/DirectoryListView.tsx b/app/components/DirectoryListView.tsxindex 21770f716..5e401b0e6 100644--- a/app/components/DirectoryListView.tsx+++ b/app/components/DirectoryListView.tsx@@ -112,6 +112,7 @@ function DirectoryListView(props: Props) {if (directoryContent && directoryContent.length > 0) {return directoryContent.map(entry => (<ListItem+ data-tid={'MoveTarget' + entry.name}title={'Navigate to: ' + entry.path}style={{ maxWidth: 250 }}onClick={() => {diff --git a/app/components/EditDescription.tsx b/app/components/EditDescription.tsxindex bcdc425f5..cd22510e9 100644--- a/app/components/EditDescription.tsx+++ b/app/components/EditDescription.tsx@@ -90,6 +90,7 @@ function EditDescription(props: Props) {</span>{toggleEditDescriptionField && editSaveActions}<div+ data-tid="descriptionTID"onDoubleClick={() => {if (toggleEditDescriptionField) {setEditMode(true);diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex 30a699b62..d209bb9f2 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -301,8 +301,8 @@ function EntryProperties(props: Props) {useEffect(() => {if (!firstRender &&- props.openedEntry != undefined &&- currentEntry.current.description !== props.openedEntry.description+ props.openedEntry != undefined+ // && currentEntry.current.description !== props.openedEntry.description) {// update descriptioncurrentEntry.current = enhanceOpenedEntry(diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex e53b0a1eb..a779e335d 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -254,7 +254,7 @@ function FolderContainer(props: Props) {/*** reflect update openedFile from perspective*/- useEffect(() => {+ /*useEffect(() => {const { editedEntryPaths, openedFiles, openEntry } = props;if (!firstRender && editedEntryPaths && editedEntryPaths.length > 0) {@@ -269,7 +269,7 @@ function FolderContainer(props: Props) {}});}- }, [props.editedEntryPaths]);+ }, [props.editedEntryPaths]);*/const [isRenameEntryDialogOpened, setIsRenameEntryDialogOpened] = useState<booleandiff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex 0f4e3369d..04064303e 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -753,11 +753,13 @@ function MainPage(props: Props) {openURLExternally={openURLExternally}/>)}- <FileUploadDialog- open={props.isUploadProgressDialogOpened !== undefined}- onClose={toggleUploadDialog}- title={props.isUploadProgressDialogOpened}- />+ {props.isUploadProgressDialogOpened !== undefined && (+ <FileUploadDialog+ open={true}+ onClose={toggleUploadDialog}+ title={props.isUploadProgressDialogOpened}+ />+ )}{props.isProgressDialogOpened && (<ProgressDialogopen={props.isProgressDialogOpened}@@ -788,13 +790,11 @@ function MainPage(props: Props) {}*//>)}- {props.isSettingsDialogOpened && (- <SettingsDialog- open={props.isSettingsDialogOpened}- openURLExternally={openURLExternally}- onClose={toggleSettingsDialog}- />- )}+ <SettingsDialog+ open={props.isSettingsDialogOpened}+ openURLExternally={openURLExternally}+ onClose={toggleSettingsDialog}+ />{KanBanImportDialog && props.selectedEntries[0] && (<KanBanImportDialogopen={props.isImportKanBanDialogOpened}diff --git a/app/package.json b/app/package.jsonindex 468bf5cca..bac6da8b1 100644--- a/app/package.json+++ b/app/package.json@@ -16,7 +16,7 @@"@tagspaces/extensions": "1.0.80"},"nodeDependencies": {- "@tagspaces/tagspaces-ws": "2.1.28",+ "@tagspaces/tagspaces-ws": "2.1.29","@tagspaces/extensions": "1.0.80","sharp": "0.31.3"}diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.tsindex 7811bacd7..e8b168445 100644--- a/app/reducers/tagging-actions.ts+++ b/app/reducers/tagging-actions.ts@@ -577,42 +577,20 @@ const actions = {: [];return removeTagsFromFilename(fsEntryMeta.isFile).then(newFilePath => {- // no file rename - only sidecar tags removed- if (newFilePath === path) {- const updatedFsEntryMeta = {- ...fsEntryMeta,- tags: newTags- };- return saveMetaDataPromise(path, updatedFsEntryMeta)- .then(() => {- dispatch(- AppActions.reflectUpdateSidecarTags(newFilePath, newTags)- );- return true;- })- .catch(err => {- console.warn(- 'Removing sidecar tags failed ' + path + ' with ' + err- );- dispatch(- AppActions.showNotification(- i18n.t('core:removingSidecarTagsFailed'),- 'error',- true- )+ return removeTagsFromSideCar(fsEntryMeta, newTags, newFilePath).then(+ () => {+ // dispatch(AppActions.reflectEditedEntryPaths([newFilePath]));+ const { openedFiles } = getState().app;+ if (openedFiles.find(obj => obj.path === path)) {+ return dispatch(+ AppActions.updateOpenedFile(path, {+ tags: newTags+ }));- return false;- });- }- // dispatch(AppActions.reflectEditedEntryPaths([newFilePath]));- const { openedFiles } = getState().app;- if (openedFiles.find(obj => obj.path === path)) {- dispatch(- AppActions.updateOpenedFile(path, {- tags: newTags- })- );- }+ }+ return true;+ }+ );});}).catch(error => {@@ -621,6 +599,38 @@ const actions = {return removeTagsFromFilename().then(() => true);});+ function removeTagsFromSideCar(+ fsEntryMeta: TS.FileSystemEntryMeta,+ newTags,+ newFilePath+ ): Promise<boolean> {+ if (newFilePath === path) {+ // no file rename - only sidecar tags removed+ const updatedFsEntryMeta = {+ ...fsEntryMeta,+ tags: newTags+ };+ return saveMetaDataPromise(path, updatedFsEntryMeta)+ .then(() => {+ dispatch(AppActions.reflectUpdateSidecarTags(newFilePath, newTags));+ return true;+ })+ .catch(err => {+ console.warn(+ 'Removing sidecar tags failed ' + path + ' with ' + err+ );+ dispatch(+ AppActions.showNotification(+ i18n.t('core:removingSidecarTagsFailed'),+ 'error',+ true+ )+ );+ return false;+ });+ }+ return Promise.resolve(true);+ }/*** return new file path* @param isFilediff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex a30bb14d4..f13eeaa53 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -770,9 +770,7 @@ export function generateFileName(// File has an extensionnewFileName =fileName.substring(0, lastDotPosition).trim() +- ' ' +- prefixTagContainer +- tagsString ++ (tagsString ? ' ' + prefixTagContainer + tagsString : '') +'.' +fileExt;}@@ -780,9 +778,7 @@ export function generateFileName(// File does not have an extensionnewFileName =fileName.substring(0, beginTagContainer).trim() +- ' ' +- prefixTagContainer +- tagsString ++ (tagsString ? ' ' + prefixTagContainer + tagsString : '') +fileName.substring(endTagContainer + 1, fileName.length).trim();}if (newFileName.length < 1) {diff --git a/package.json b/package.jsonindex 822b1ee5e..e67f55592 100644--- a/package.json+++ b/package.json@@ -161,7 +161,7 @@"@mui/styles": "5.10.15","@mui/x-date-pickers": "^5.0.8","@tagspaces/tagspaces-md": "2.1.6",- "@tagspaces/tagspaces-platforms": "2.1.28",+ "@tagspaces/tagspaces-platforms": "2.1.29","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.jsindex 6c9d97199..0ae404b24 100644--- a/tests/e2e/fileopener.pw.e2e.js+++ b/tests/e2e/fileopener.pw.e2e.js@@ -226,7 +226,12 @@ describe('TST08 - File folder properties', () => {it.skip('TST3004 - Folder Tagging [Pro]', async () => {});- it.skip('TST3001 - Description for files [Pro]', async () => {});+ it.skip('TST3001 - Description for files -Pro [electron]', async () => {+ // open fileProperties+ await clickOn(selectorFile);+ await global.client.dblclick('[data-tid=descriptionTID]');+ await clickOn('[data-tid=descriptionTID]');+ });it.skip('TST3005 - Description for folders [Pro]', async () => {});diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 2eb158d98..157789875 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -668,7 +668,8 @@ export function generateFileName(fileName, fileExt, tags, tagDelimiter = ' ') {beginTagContainer >= endTagContainer) {// File does not have an extension- newFileName = fileName.trim() + tagsString + '.' + fileExt;+ newFileName =+ fileName.trim() + (tagsString ? ' ' + tagsString : '') + '.' + fileExt;} else {// File does not have an extensionnewFileName =diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.jsindex 7485c9d94..424752494 100644--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js@@ -320,10 +320,11 @@ describe('TST50** - Right button on a file', () => {const fileName = 'sample.pdf';const fileSelector = getGridFileSelector(fileName);await openContextEntryMenu(fileSelector, 'fileMenuMoveCopyFile');- await setInputKeys(+ await clickOn('[data-tid=MoveTargetempty_folder]');+ /*await setInputKeys('targetPathInput',defaultLocationPath + '/empty_folder'- );+ );*/await clickOn('[data-tid=confirmMoveFiles]');await waitForNotification();@@ -338,7 +339,7 @@ describe('TST50** - Right button on a file', () => {// Copy file in parent directoryawait openContextEntryMenu(fileSelector, 'fileMenuMoveCopyFile');- await setInputKeys('targetPathInput', defaultLocationPath);+ // await setInputKeys('targetPathInput', defaultLocationPath);await clickOn('[data-tid=confirmCopyFiles]');await waitForNotification();// await clickOn('#clearSearchID');diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.jsindex b79c92f3d..39921fa58 100644--- a/tests/e2e/perspective-grid.pw.e2e.js+++ b/tests/e2e/perspective-grid.pw.e2e.js@@ -294,16 +294,17 @@ describe('TST50 - Perspective Grid', () => {test('TST5008 - Copy file [web,minio,electron]', async () => {const sampleFileName = 'sample.txt';// Electron path: ./testdata-tmp/file-structure/supported-filestypes/empty_folder- const copyLocationPath = global.isElectron+ /*const copyLocationPath = global.isElectron? defaultLocationPath + '/empty_folder'- : 'empty_folder';+ : 'empty_folder';*/// const fileName = await getFirstFileName();// select fileawait clickOn(getGridFileSelector(sampleFileName));// open Copy File Dialogawait clickOn('[data-tid=gridPerspectiveCopySelectedFiles]');- await setInputKeys('targetPathInput', copyLocationPath);+ //await setInputKeys('targetPathInput', copyLocationPath);+ await clickOn('[data-tid=MoveTargetempty_folder]');await clickOn('[data-tid=confirmCopyFiles]');//await waitForNotification();