Skip to content

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

fix: showing thumbs and opening files from global search

Ilian Sapundshievc0264a650ab0
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index fc9140011..705082ffb 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -1354,7 +1354,9 @@ export const actions = {
fsEntry.path,
fsEntry.isFile
);
- if (PlatformIO.haveObjectStoreSupport()) {
+ if (fsEntry.url) {
+ entryForOpening.url = fsEntry.url;
+ } else if (PlatformIO.haveObjectStoreSupport()) {
entryForOpening.url = PlatformIO.getURLforPath(fsEntry.path);
}
if (fsEntry.perspective) {
diff --git a/app/reducers/location-index.ts b/app/reducers/location-index.ts
index 528cb9d01..508232a4a 100644
--- a/app/reducers/location-index.ts
+++ b/app/reducers/location-index.ts
@@ -302,6 +302,7 @@ export const actions = {
);
return;
}
+ const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
dispatch(
AppActions.showNotification(i18n.t('core:searching'), 'default', false)
);
@@ -343,6 +344,17 @@ export const actions = {
}
Search.searchLocationIndex(GlobalSearch.index, searchQuery)
.then(searchResults => {
+ if (isCloudLocation) {
+ searchResults.forEach((entry: FileSystemEntry) => {
+ if (
+ entry.thumbPath &&
+ entry.thumbPath.length > 1 &&
+ !entry.thumbPath.startsWith('http')
+ ) {
+ entry.thumbPath = PlatformIO.getURLforPath(entry.thumbPath);
+ }
+ });
+ }
dispatch(AppActions.setSearchResults(searchResults));
dispatch(AppActions.hideNotifications());
return true;
@@ -439,6 +451,16 @@ export const actions = {
(entry: FileSystemEntry) => {
// Excluding s3 folders from global search
if (entry && entry.isFile) {
+ entry.url = PlatformIO.getURLforPath(entry.path);
+ if (
+ entry.thumbPath &&
+ entry.thumbPath.length > 1 &&
+ !entry.thumbPath.startsWith('http')
+ ) {
+ entry.thumbPath = PlatformIO.getURLforPath(
+ entry.thumbPath
+ );
+ }
return entry;
}
}
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index 82af8660c..8bf6192ef 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -162,9 +162,6 @@ export function enhanceEntry(entry: any): FileSystemEntry {
if (entry && entry.thumbPath) {
enhancedEntry.thumbPath = entry.thumbPath;
}
- if (entry && entry.url) {
- enhancedEntry.url = entry.url;
- }
if (entry && entry.textContent) {
enhancedEntry.textContent = entry.textContent;
}