Skip to content

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

Search-by-file-id-add-id-to-the-sharing-links (#2176)

Stanimir0020993c5ca7
diff --git a/package-lock.json b/package-lock.json
index a9ed68901..da32fc2a9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,10 +19,10 @@
"@mui/lab": "5.0.0-alpha.170",
"@mui/material": "^5.15.19",
"@mui/x-date-pickers": "^5.0.20",
- "@tagspaces/tagspaces-common": "4.5.15",
- "@tagspaces/tagspaces-common-aws3": "4.5.16",
- "@tagspaces/tagspaces-common-cordova": "4.5.15",
- "@tagspaces/tagspaces-indexer": "4.5.15",
+ "@tagspaces/tagspaces-common": "4.5.19",
+ "@tagspaces/tagspaces-common-aws3": "4.5.19",
+ "@tagspaces/tagspaces-common-cordova": "4.5.19",
+ "@tagspaces/tagspaces-indexer": "4.5.19",
"@tagspaces/tagspaces-md": "4.5.18",
"aws-amplify": "^4.3.8",
"classnames": "^2.3.1",
@@ -17140,9 +17140,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.15.tgz",
- "integrity": "sha512-v3CYMUNpR3Xs4+7m3dEiJ0RrdUsonlhDlx8H9Iz9yNpnKbCzvVsoDG62aR19/B9YfL/JbG455EMTGm+dSjnChg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.19.tgz",
+ "integrity": "sha512-cuSFo/s/BSgGZHZnzoA7WbvMMAGgCWFfbO/QZlgaF8og4xCrBmQoqSVk6W36pCir+KiZFSvwYHKw8dLVUBqUGg==",
"dependencies": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -17150,23 +17150,23 @@
}
},
"node_modules/@tagspaces/tagspaces-common-aws3": {
- "version": "4.5.16",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.16.tgz",
- "integrity": "sha512-tSP37NCle7+Qkn5JZIww7SVlFIMwuajFLW74FdUfiMdF9y5dIiOWXnslXHbyCls5HmBvKPeGzniSMURRaylDnQ==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.19.tgz",
+ "integrity": "sha512-8CKaeBU1jl6huPFaLnwBsEtvqtpcZDB8Ir4icm65ffC8Hyunm7/vaDdb590gsB7maYv2uCivGka3FAC96uYc9w==",
"dependencies": {
"@aws-sdk/client-s3": "^3.624.0",
"@aws-sdk/lib-storage": "^3.624.0",
"@aws-sdk/s3-request-presigner": "^3.624.0",
- "@tagspaces/tagspaces-common": "^4.5.15",
+ "@tagspaces/tagspaces-common": "^4.5.19",
"crypto-js": "^4.2.0"
}
},
"node_modules/@tagspaces/tagspaces-common-cordova": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.15.tgz",
- "integrity": "sha512-s1KqNx7AbK2UpDWxWVro7uX1l1JkEIYgB3Zs8QxJEe4nImgEH9CxZoWw0cPA/YARLudGDvF5EZzXC7DKUTQPvg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.19.tgz",
+ "integrity": "sha512-ioEiiZXpewxi7OZJK0FCPdD+xRG/Zman3pSLLyTCQh++Haap8fIRXNJyjzCzrJYdyFT0qFrOUIBl6NCFgl6qjg==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.15"
+ "@tagspaces/tagspaces-common": "^4.5.19"
}
},
"node_modules/@tagspaces/tagspaces-common/node_modules/uuid": {
@@ -17178,11 +17178,11 @@
}
},
"node_modules/@tagspaces/tagspaces-indexer": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.15.tgz",
- "integrity": "sha512-Dvnn8Wc5znSEfhMYmn2VBavruV+ev8qN/be0e+b4LuarCn04rFw6UENrvf2zOvZTBvdMMyNqq/X5ZoIQuEYMhw==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.19.tgz",
+ "integrity": "sha512-w7308cY1jXDgMGUl6sYfRMQiSw6miLcDK+dnOymzl0fmKcua6W+gURUr/OqcVYCGbjTi/hlUhT0qn7zrlG5u6g==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.15"
+ "@tagspaces/tagspaces-common": "^4.5.19"
}
},
"node_modules/@tagspaces/tagspaces-md": {
diff --git a/package.json b/package.json
index dfd9b93fd..9b98cf8cd 100644
--- a/package.json
+++ b/package.json
@@ -166,10 +166,10 @@
"@mui/lab": "5.0.0-alpha.170",
"@mui/material": "^5.15.19",
"@mui/x-date-pickers": "^5.0.20",
- "@tagspaces/tagspaces-common": "4.5.15",
- "@tagspaces/tagspaces-common-aws3": "4.5.16",
- "@tagspaces/tagspaces-common-cordova": "4.5.15",
- "@tagspaces/tagspaces-indexer": "4.5.15",
+ "@tagspaces/tagspaces-common": "4.5.19",
+ "@tagspaces/tagspaces-common-aws3": "4.5.19",
+ "@tagspaces/tagspaces-common-cordova": "4.5.19",
+ "@tagspaces/tagspaces-indexer": "4.5.19",
"@tagspaces/tagspaces-md": "4.5.18",
"aws-amplify": "^4.3.8",
"classnames": "^2.3.1",
diff --git a/release/app/package-lock.json b/release/app/package-lock.json
index 7204f488c..0c7116f51 100644
--- a/release/app/package-lock.json
+++ b/release/app/package-lock.json
@@ -12,8 +12,8 @@
"dependencies": {
"@elife/pm2": "3.6.1",
"@tagspaces/extensions": "1.0.129",
- "@tagspaces/tagspaces-common-node": "4.5.15",
- "@tagspaces/tagspaces-ws": "4.5.15",
+ "@tagspaces/tagspaces-common-node": "4.5.19",
+ "@tagspaces/tagspaces-ws": "4.5.19",
"sharp": "0.32.6",
"ws": "8.16.0"
},
@@ -43,9 +43,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.15.tgz",
- "integrity": "sha512-v3CYMUNpR3Xs4+7m3dEiJ0RrdUsonlhDlx8H9Iz9yNpnKbCzvVsoDG62aR19/B9YfL/JbG455EMTGm+dSjnChg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.19.tgz",
+ "integrity": "sha512-cuSFo/s/BSgGZHZnzoA7WbvMMAGgCWFfbO/QZlgaF8og4xCrBmQoqSVk6W36pCir+KiZFSvwYHKw8dLVUBqUGg==",
"dependencies": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -53,11 +53,11 @@
}
},
"node_modules/@tagspaces/tagspaces-common-node": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.15.tgz",
- "integrity": "sha512-meMVdY/8tjpF2vcHMt7qnyJt0oUQGMBLTGqUmqxykLMFKqhv+d3L0LdOh+BOCHhtd44f+348WCZQzqy0gns3Xg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.19.tgz",
+ "integrity": "sha512-NalixXlYBDTymE7OVobgGWsaoATGcsELQTCe5Lmj/qldRZxF0+pn7XCvMv4koLduJbQ9/qhwizqpZkDtIpuHSw==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.15",
+ "@tagspaces/tagspaces-common": "^4.5.19",
"adm-zip": "0.5.10",
"fs-extra": "^10.0.0",
"klaw": "^4.1.0",
@@ -74,22 +74,22 @@
}
},
"node_modules/@tagspaces/tagspaces-workers": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.15.tgz",
- "integrity": "sha512-MAoAFHxVKhM+YQ/Wj6cjVURZj/RLgIfY8LDGMTvS4P/+kk5wGLTtUAX0c1Hs3Lb/Kw0MMFHNMpWYW8AK2LcfXg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.19.tgz",
+ "integrity": "sha512-FXmc/TMSOkLZdV7uDyHjlegWEe35Nv7xRhRBuSqwo+NiQ8HCWXKFxlSV+PPoclXsie6stOtMseJDDW+0Wq4MoQ==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.15",
- "@tagspaces/tagspaces-common-node": "^4.5.15",
+ "@tagspaces/tagspaces-common": "^4.5.19",
+ "@tagspaces/tagspaces-common-node": "^4.5.19",
"@tagspaces/tagspaces-thumbgen-image": "^4.2.3",
"fswin": "^3.24.524"
}
},
"node_modules/@tagspaces/tagspaces-ws": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.15.tgz",
- "integrity": "sha512-XbwKe5Qpy4kAFPSiqJsEBO/BGcACfBOu4aZPRWXEVX3SfD9qtwpLwf/CHLXhaG+BTSwbuiiUCulvTvzFeNsChw==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.19.tgz",
+ "integrity": "sha512-T/fKK8HlHcgOYNOEdLzfowqeN53ZX71gmwAX0i5BNS8Ivcj+GLm1FJd7jO7yT9hTqLeHlntmuqVPHX7v95L5TA==",
"dependencies": {
- "@tagspaces/tagspaces-workers": "^4.5.15",
+ "@tagspaces/tagspaces-workers": "^4.5.19",
"find-free-ports": "^3.1.1",
"jsonwebtoken": "^8.5.1",
"ws": "^8.15.1"
@@ -392,9 +392,9 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/fswin": {
- "version": "3.24.524",
- "resolved": "https://registry.npmjs.org/fswin/-/fswin-3.24.524.tgz",
- "integrity": "sha512-+rQoE77yuYzMLArCfe1cjk6tFbEko2csU6Fmu3guX3W+FJ+5vD14bPdw6rD8/rFj/uvFXa1qtSkB1M16k4Ibng==",
+ "version": "3.24.829",
+ "resolved": "https://registry.npmjs.org/fswin/-/fswin-3.24.829.tgz",
+ "integrity": "sha512-t3KHDNSMHbUzjpzb35c+27dGMLcE5gXvYZ4to5BITvCvPr3dZvX41VUzgEMQ8mVozbn5uiQ9p61/cQVLDEy+ag==",
"engines": {
"node": ">= 8.0"
}
@@ -1131,9 +1131,9 @@
}
},
"@tagspaces/tagspaces-common": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.15.tgz",
- "integrity": "sha512-v3CYMUNpR3Xs4+7m3dEiJ0RrdUsonlhDlx8H9Iz9yNpnKbCzvVsoDG62aR19/B9YfL/JbG455EMTGm+dSjnChg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.19.tgz",
+ "integrity": "sha512-cuSFo/s/BSgGZHZnzoA7WbvMMAGgCWFfbO/QZlgaF8og4xCrBmQoqSVk6W36pCir+KiZFSvwYHKw8dLVUBqUGg==",
"requires": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -1141,11 +1141,11 @@
}
},
"@tagspaces/tagspaces-common-node": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.15.tgz",
- "integrity": "sha512-meMVdY/8tjpF2vcHMt7qnyJt0oUQGMBLTGqUmqxykLMFKqhv+d3L0LdOh+BOCHhtd44f+348WCZQzqy0gns3Xg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.19.tgz",
+ "integrity": "sha512-NalixXlYBDTymE7OVobgGWsaoATGcsELQTCe5Lmj/qldRZxF0+pn7XCvMv4koLduJbQ9/qhwizqpZkDtIpuHSw==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.15",
+ "@tagspaces/tagspaces-common": "^4.5.19",
"adm-zip": "0.5.10",
"fs-extra": "^10.0.0",
"klaw": "^4.1.0",
@@ -1162,22 +1162,22 @@
}
},
"@tagspaces/tagspaces-workers": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.15.tgz",
- "integrity": "sha512-MAoAFHxVKhM+YQ/Wj6cjVURZj/RLgIfY8LDGMTvS4P/+kk5wGLTtUAX0c1Hs3Lb/Kw0MMFHNMpWYW8AK2LcfXg==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.19.tgz",
+ "integrity": "sha512-FXmc/TMSOkLZdV7uDyHjlegWEe35Nv7xRhRBuSqwo+NiQ8HCWXKFxlSV+PPoclXsie6stOtMseJDDW+0Wq4MoQ==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.15",
- "@tagspaces/tagspaces-common-node": "^4.5.15",
+ "@tagspaces/tagspaces-common": "^4.5.19",
+ "@tagspaces/tagspaces-common-node": "^4.5.19",
"@tagspaces/tagspaces-thumbgen-image": "^4.2.3",
"fswin": "^3.24.524"
}
},
"@tagspaces/tagspaces-ws": {
- "version": "4.5.15",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.15.tgz",
- "integrity": "sha512-XbwKe5Qpy4kAFPSiqJsEBO/BGcACfBOu4aZPRWXEVX3SfD9qtwpLwf/CHLXhaG+BTSwbuiiUCulvTvzFeNsChw==",
+ "version": "4.5.19",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.19.tgz",
+ "integrity": "sha512-T/fKK8HlHcgOYNOEdLzfowqeN53ZX71gmwAX0i5BNS8Ivcj+GLm1FJd7jO7yT9hTqLeHlntmuqVPHX7v95L5TA==",
"requires": {
- "@tagspaces/tagspaces-workers": "^4.5.15",
+ "@tagspaces/tagspaces-workers": "^4.5.19",
"find-free-ports": "^3.1.1",
"jsonwebtoken": "^8.5.1",
"ws": "^8.15.1"
@@ -1409,9 +1409,9 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"fswin": {
- "version": "3.24.524",
- "resolved": "https://registry.npmjs.org/fswin/-/fswin-3.24.524.tgz",
- "integrity": "sha512-+rQoE77yuYzMLArCfe1cjk6tFbEko2csU6Fmu3guX3W+FJ+5vD14bPdw6rD8/rFj/uvFXa1qtSkB1M16k4Ibng=="
+ "version": "3.24.829",
+ "resolved": "https://registry.npmjs.org/fswin/-/fswin-3.24.829.tgz",
+ "integrity": "sha512-t3KHDNSMHbUzjpzb35c+27dGMLcE5gXvYZ4to5BITvCvPr3dZvX41VUzgEMQ8mVozbn5uiQ9p61/cQVLDEy+ag=="
},
"function-bind": {
"version": "1.1.2",
diff --git a/release/app/package.json b/release/app/package.json
index 7b091eafa..d492fb038 100644
--- a/release/app/package.json
+++ b/release/app/package.json
@@ -19,8 +19,8 @@
"dependencies": {
"@elife/pm2": "3.6.1",
"@tagspaces/extensions": "1.0.129",
- "@tagspaces/tagspaces-common-node": "4.5.15",
- "@tagspaces/tagspaces-ws": "4.5.15",
+ "@tagspaces/tagspaces-common-node": "4.5.19",
+ "@tagspaces/tagspaces-ws": "4.5.19",
"sharp": "0.32.6",
"ws": "8.16.0"
},
diff --git a/src/main/mainEvents.ts b/src/main/mainEvents.ts
index 6856b48bd..ebf2b23a0 100644
--- a/src/main/mainEvents.ts
+++ b/src/main/mainEvents.ts
@@ -253,7 +253,7 @@ export default function loadMainEvents() {
);
ipcMain.handle(
'renameFilePromise',
- async (event, filePath, newFilePath, withProgress) => {
+ async (event, filePath, newFilePath, withProgress, force) => {
let result;
if (withProgress) {
progress['renameFilePromise'] = newProgress('renameFilePromise', 1);
@@ -261,9 +261,15 @@ export default function loadMainEvents() {
filePath,
newFilePath,
getOnProgress('renameFilePromise', progress),
+ force,
);
} else {
- result = await renameFilePromise(filePath, newFilePath, undefined);
+ result = await renameFilePromise(
+ filePath,
+ newFilePath,
+ undefined,
+ force,
+ );
}
return result;
},
diff --git a/src/renderer/containers/Root.tsx b/src/renderer/containers/Root.tsx
index 0bc238679..8d72a7199 100644
--- a/src/renderer/containers/Root.tsx
+++ b/src/renderer/containers/Root.tsx
@@ -84,8 +84,8 @@ export default function Root({ store, persistor }: RootType) {
<FSWatcherContextProvider>
<PlatformFacadeContextProvider>
<LocationIndexContextProvider>
- <OpenedEntryContextProvider>
- <IOActionsContextProvider>
+ <IOActionsContextProvider>
+ <OpenedEntryContextProvider>
<TagGroupsLocationContextProvider>
<TaggingActionsContextProvider>
<DndProvider backend={HTML5Backend}>
@@ -117,8 +117,8 @@ export default function Root({ store, persistor }: RootType) {
</DndProvider>
</TaggingActionsContextProvider>
</TagGroupsLocationContextProvider>
- </IOActionsContextProvider>
- </OpenedEntryContextProvider>
+ </OpenedEntryContextProvider>
+ </IOActionsContextProvider>
</LocationIndexContextProvider>
</PlatformFacadeContextProvider>
</FSWatcherContextProvider>
diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsx
index bf2d99e56..19f35dca3 100644
--- a/src/renderer/hooks/IOActionsContextProvider.tsx
+++ b/src/renderer/hooks/IOActionsContextProvider.tsx
@@ -151,6 +151,11 @@ type IOActionsContextData = {
entry: TS.FileSystemEntry,
metaData: any,
) => Promise<TS.FileSystemEntryMeta>;
+ getMetadata: (
+ path: string,
+ id: string,
+ location: CommonLocation,
+ ) => Promise<TS.FileSystemEntryMeta>;
getMetadataID: (
path: string,
id: string,
@@ -231,6 +236,7 @@ export const IOActionsContext = createContext<IOActionsContextData>({
duplicateFile: undefined,
saveCurrentLocationMetaData: undefined,
saveMetaDataPromise: undefined,
+ getMetadata: undefined,
getMetadataID: undefined,
saveFsEntryMeta: undefined,
savePerspective: undefined,
@@ -643,13 +649,19 @@ export const IOActionsContextProvider = ({
]);
return true;
});
- return moveFilesPromise(moveMetaJobs, location.uuid, undefined, false)
+ return moveFilesPromise(
+ moveMetaJobs,
+ location.uuid,
+ undefined,
+ false,
+ true,
+ )
.then(() => {
console.log('Moving meta and thumbs successful');
return reflect && reflectMoveFiles(moveJobs);
})
.catch((err) => {
- console.log('At least one meta or thumb was not moved ' + err);
+ console.log('At least one meta or thumb was not moved ', err);
return reflect && reflectMoveFiles(moveJobs);
});
} else {
@@ -735,17 +747,25 @@ export const IOActionsContextProvider = ({
.then((success) => {
if (success) {
showNotification(t('core:filesCopiedSuccessful'));
- const metaPaths = paths.flatMap((path) => [
- getMetaFileLocationForFile(
- path,
- currentLocation?.getDirSeparator(),
- ),
- getThumbFileLocationForFile(
- path,
- currentLocation?.getDirSeparator(),
- false,
- ),
- ]);
+ const metaPaths = paths.flatMap((path) =>
+ path.indexOf(
+ AppConfig.dirSeparator +
+ AppConfig.metaFolder +
+ AppConfig.dirSeparator,
+ ) !== -1
+ ? []
+ : [
+ getMetaFileLocationForFile(
+ path,
+ currentLocation?.getDirSeparator(),
+ ),
+ getThumbFileLocationForFile(
+ path,
+ currentLocation?.getDirSeparator(),
+ false,
+ ),
+ ],
+ );
return copyFilesWithProgress(
metaPaths,
@@ -1547,29 +1567,38 @@ export const IOActionsContextProvider = ({
id: string,
location: CommonLocation,
): Promise<string> {
+ return getMetadata(path, id, location).then((metaData) => metaData.id);
+ }
+
+ function getMetadata(
+ path: string,
+ id: string,
+ location: CommonLocation,
+ ): Promise<TS.FileSystemEntryMeta> {
return location
.loadMetaDataPromise(path)
.then((fsEntryMeta: TS.FileSystemEntryMeta) => {
if (fsEntryMeta.id) {
- return fsEntryMeta.id;
+ return fsEntryMeta;
} else {
return saveFsEntryMeta(location.toFsEntry(path, fsEntryMeta.isFile), {
...fsEntryMeta,
id: id,
- }).then((fsEntryMeta) => fsEntryMeta.id);
+ }).then((fsEntryMeta) => fsEntryMeta);
}
})
.catch(() => {
// create new meta id to not be changed -> next time listDirectory will get the same id for the file from meta
- const content = JSON.stringify({ id: id });
+ const mataData = { id: id };
const metaFilePath = path.endsWith(location.getDirSeparator())
? getMetaFileLocationForDir(path, location.getDirSeparator())
: getMetaFileLocationForFile(path, location.getDirSeparator());
+
return saveTextFilePromise(
{ path: metaFilePath, locationID: location.uuid },
- content,
+ JSON.stringify(mataData),
true,
- ).then(() => id);
+ ).then(() => mataData);
});
}
@@ -2137,6 +2166,7 @@ export const IOActionsContextProvider = ({
duplicateFile,
saveCurrentLocationMetaData,
saveMetaDataPromise,
+ getMetadata,
getMetadataID,
saveFsEntryMeta,
savePerspective,
diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsx
index 1be137a1f..758e90981 100644
--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx
+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx
@@ -22,6 +22,7 @@ import React, {
useMemo,
useReducer,
useRef,
+ useState,
} from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { AppDispatch } from '-/reducers/app';
@@ -66,6 +67,8 @@ import { useEditedEntryContext } from '-/hooks/useEditedEntryContext';
import { useEditedEntryMetaContext } from '-/hooks/useEditedEntryMetaContext';
import { CommonLocation } from '-/utils/CommonLocation';
import { useFilePropertiesContext } from '-/hooks/useFilePropertiesContext';
+import { useIOActionsContext } from '-/hooks/useIOActionsContext';
+import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
type OpenedEntryContextData = {
openedEntry: TS.OpenedEntry;
@@ -144,11 +147,13 @@ export const OpenedEntryContextProvider = ({
const { currentLocation, findLocation, openLocation, getLocationPath } =
useCurrentLocationContext();
+ const { getMetadata } = useIOActionsContext();
const {
currentDirectoryPath,
currentLocationPath,
openDirectory,
getAllPropertiesPromise,
+ setSearchQuery,
} = useDirectoryContentContext();
const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();
@@ -162,15 +167,12 @@ export const OpenedEntryContextProvider = ({
//const locations: CommonLocation[] = useSelector(getLocations);
const newHTMLFileContent = useSelector(getNewHTMLFileContent);
const currentEntry = useRef<TS.OpenedEntry>(undefined);
- /* const dirProps = useRef<TS.DirProp>({
- totalSize: undefined,
- filesCount: undefined,
- dirsCount: undefined,
- });*/
const fileChanged = useRef<boolean>(false);
const isEntryInFullWidth = useRef<boolean>(false);
const sharingLink = useRef<string>(undefined);
const sharingParentFolderLink = useRef<string>(undefined);
+ const [isLinkFromSearchDialogOpened, setLinkFromSearchConfirmDialogOpened] =
+ useState<string>(undefined);
const firstRender = useFirstRender();
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
@@ -347,6 +349,7 @@ export const OpenedEntryContextProvider = ({
openedFile.locationID,
relativePath,
relativeDirPath,
+ openedFile.uuid,
);
} else {
const relativePath = getRelativeEntryPath(
@@ -358,6 +361,7 @@ export const OpenedEntryContextProvider = ({
openedFile.locationID,
undefined,
relativePath,
+ openedFile.uuid,
);
}
} else {
@@ -590,6 +594,11 @@ export const OpenedEntryContextProvider = ({
} else if (fsEntry.url) {
entryForOpening.url = fsEntry.url;
}
+ //set meta and generate new meta id if not exist
+ const meta = await getMetadata(fsEntry.path, fsEntry.uuid, loc);
+ entryForOpening.uuid = meta.id;
+ entryForOpening.meta = { ...fsEntry.meta, ...meta };
+
if (
fsEntry.isNewFile &&
AppConfig.editableFiles.includes(fsEntry.extension)
@@ -674,6 +683,7 @@ export const OpenedEntryContextProvider = ({
const dPath = getURLParameter('tsdpath', url);
const ePath = getURLParameter('tsepath', url);
const cmdOpen = getURLParameter('cmdopen', url);
+ const id = getURLParameter('tseid', url);
if (cmdOpen && cmdOpen.length > 0) {
const entryPath = decodeURIComponent(cmdOpen);
getAllPropertiesPromise(entryPath, lid)
@@ -751,6 +761,7 @@ export const OpenedEntryContextProvider = ({
// });
} else {
// local files case
+ let dirPath = locationPath;
if (directoryPath && directoryPath.length > 0) {
if (
directoryPath.includes('../') ||
@@ -760,38 +771,60 @@ export const OpenedEntryContextProvider = ({
return true;
}
- const dirFullPath = joinPaths(
+ dirPath = joinPaths(
targetLocation.getDirSeparator(),
locationPath,
directoryPath,
);
-
- openDirectory(dirFullPath, undefined, targetLocation);
- } else {
- openDirectory(locationPath, undefined, targetLocation);
}
-
- if (entryPath && entryPath.length > 0) {
- if (entryPath.includes('../') || entryPath.includes('..\\')) {
- showNotification(t('core:invalidLink'), 'warning', true);
- return true;
- }
- const entryFullPath =
- locationPath + targetLocation.getDirSeparator() + entryPath;
- getAllPropertiesPromise(entryFullPath, lid)
- .then((fsEntry: TS.FileSystemEntry) => {
- if (fsEntry) {
- openFsEntry(fsEntry);
- if (options.fullWidth) {
- setEntryInFullWidth(true);
+ targetLocation.checkDirExist(dirPath).then((exist) => {
+ if (exist) {
+ openDirectory(dirPath, undefined, targetLocation).then(() => {
+ if (entryPath && entryPath.length > 0) {
+ if (
+ entryPath.includes('../') ||
+ entryPath.includes('..\\')
+ ) {
+ showNotification(
+ t('core:invalidLink'),
+ 'warning',
+ true,
+ );
+ return true;
}
+ const entryFullPath =
+ locationPath +
+ targetLocation.getDirSeparator() +
+ entryPath;
+ getAllPropertiesPromise(entryFullPath, lid)
+ .then((fsEntry: TS.FileSystemEntry) => {
+ if (fsEntry) {
+ openFsEntry(fsEntry);
+ if (options.fullWidth) {
+ setEntryInFullWidth(true);
+ }
+ } else if (id) {
+ //ENTRY NOT EXIST maybe moved
+ setLinkFromSearchConfirmDialogOpened(id);
+ }
+ return true;
+ })
+ .catch(() =>
+ showNotification(
+ t('core:invalidLink'),
+ 'warning',
+ true,
+ ),
+ );
}
- return true;
- })
- .catch(() =>
- showNotification(t('core:invalidLink'), 'warning', true),
- );
- }
+ });
+ } else if (id) {
+ //ENTRY NOT EXIST maybe moved
+ setLinkFromSearchConfirmDialogOpened(id);
+ } else {
+ showNotification(t('core:invalidLink'), 'warning', true);
+ }
+ });
}
//}, openLocationTimer);
});
@@ -998,6 +1031,29 @@ export const OpenedEntryContextProvider = ({
return (
<OpenedEntryContext.Provider value={context}>
{children}
+ <ConfirmDialog
+ open={isLinkFromSearchDialogOpened !== undefined}
+ onClose={() => {
+ setLinkFromSearchConfirmDialogOpened(undefined);
+ }}
+ title={t('core:invalidSharingLink')}
+ content={t('core:confirmSearchById')}
+ confirmCallback={(result) => {
+ if (result) {
+ setSearchQuery({
+ textQuery: isLinkFromSearchDialogOpened,
+ searchBoxing: 'location',
+ searchType: 'strict',
+ maxSearchResults: 1,
+ forceIndexing: true,
+ executeSearch: true,
+ });
+ }
+ }}
+ cancelDialogTID="linkFromSearchDialogCancel"
+ confirmDialogTID="linkFromSearchDialogConfirm"
+ confirmDialogContentTID="linkFromSearchDialogContent"
+ />
</OpenedEntryContext.Provider>
);
};
diff --git a/src/renderer/hooks/PlatformFacadeContextProvider.tsx b/src/renderer/hooks/PlatformFacadeContextProvider.tsx
index 5d5927567..3b7bf545a 100644
--- a/src/renderer/hooks/PlatformFacadeContextProvider.tsx
+++ b/src/renderer/hooks/PlatformFacadeContextProvider.tsx
@@ -93,6 +93,7 @@ type PlatformFacadeContextData = {
locationID: string,
onProgress?,
reflect?,
+ force?,
) => Promise<any>;
reflectMoveFiles: (moveJobs: Array<Array<string>>) => Promise<boolean>;
renameDirectoryPromise: (
@@ -475,6 +476,7 @@ export const PlatformFacadeContextProvider = ({
locationID: string,
onProgress = undefined,
reflect = true,
+ force = false,
): Promise<any> {
const flatArray = renameJobs.flat();
ignoreByWatcher(...flatArray);
@@ -485,6 +487,7 @@ export const PlatformFacadeContextProvider = ({
renameJob[0],
renameJob[1],
onProgress,
+ force,
);
} catch (err) {
console.log('Error rename file:', err);
diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.json
index 25ee02ac0..97e703eeb 100644
--- a/src/renderer/locales/en/core.json
+++ b/src/renderer/locales/en/core.json
@@ -865,5 +865,7 @@
"urlValidationHelp": "Invalid URL",
"openSharingLink": "Open sharing links created with the TagSpaces (ts:// links)",
"newFromDownloadURL": "New From URL",
+ "invalidSharingLink": "Invalid Sharing Link",
+ "confirmSearchById": "Do you want to search for the file or folder by its ID?",
"-": "-"
}
diff --git a/src/renderer/utils/CommonLocation.ts b/src/renderer/utils/CommonLocation.ts
index 02bac9ce3..3af87a44b 100644
--- a/src/renderer/utils/CommonLocation.ts
+++ b/src/renderer/utils/CommonLocation.ts
@@ -473,6 +473,7 @@ export class CommonLocation implements TS.Location {
filePath: string,
newFilePath: string,
onProgress = undefined,
+ force = false,
): Promise<any> => {
if (this.ioAPI) {
if (this.haveObjectStoreSupport()) {
@@ -494,6 +495,7 @@ export class CommonLocation implements TS.Location {
filePath,
newFilePath,
onProgress !== undefined,
+ force,
);
}
return Promise.reject(new Error('renameFilePromise: not implemented'));
@@ -930,7 +932,7 @@ export class CommonLocation implements TS.Location {
);
}
return {
- id: getUuid(),
+ //id: getUuid(),
isFile: true,
color: '',
tags: [],
@@ -952,7 +954,7 @@ export class CommonLocation implements TS.Location {
throw new Error('loadDirMetaDataPromise ' + metaDirPath + ' not exist');
}
return {
- id: getUuid(),
+ //id: getUuid(),
isFile: false,
color: '',
perspective: 'grid',