Skip to content

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

fix web thumbnails (#1550)

Stanimird36f9b366262
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index f27a66da2..0b75f5c40 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -491,7 +491,8 @@ const EntryProperties = (props: Props) => {
if (currentEntry.isFile) {
thumbPath = getThumbFileLocationForFile(
currentEntry.path,
- PlatformIO.getDirSeparator()
+ PlatformIO.getDirSeparator(),
+ false
);
} else {
thumbPath = getThumbFileLocationForDirectory(
diff --git a/app/services/electron-io.ts b/app/services/electron-io.ts
index 19e10baaf..1fd5baa56 100644
--- a/app/services/electron-io.ts
+++ b/app/services/electron-io.ts
@@ -408,11 +408,11 @@ export default class ElectronIO {
}
// Read tsm.json from sub folders
- if (!eentry.isFile && mode.includes('extractThumbPath')) {
+ if (!eentry.isFile && mode.includes('extractThumbPath') && !eentry.path.includes(AppConfig.dirSeparator + AppConfig.metaFolder)) {
const folderMetaPath =
eentry.path +
AppConfig.dirSeparator +
- (!eentry.path.includes('/' + AppConfig.metaFolder)
+ (!eentry.path.includes(AppConfig.dirSeparator + AppConfig.metaFolder) // TODO this will set parent folder description to /.ts folder too
? AppConfig.metaFolder + AppConfig.dirSeparator
: '') +
AppConfig.metaFolderFile;
diff --git a/app/services/platform-io.ts b/app/services/platform-io.ts
index 32c2a069a..0b952deaa 100644
--- a/app/services/platform-io.ts
+++ b/app/services/platform-io.ts
@@ -305,18 +305,20 @@ export default class PlatformIO {
filePath: string,
newFilePath: string
): Promise<any> => {
+ const path = decodeURIComponent(filePath);
+ const newPath = decodeURIComponent(newFilePath);
if (objectStoreAPI) {
const param = {
- path: filePath,
+ path,
bucketName: objectStoreAPI.config().bucketName
};
- return objectStoreAPI.renameFilePromise(param, newFilePath);
+ return objectStoreAPI.renameFilePromise(param, newPath);
// .then(result => result);
}
- PlatformIO.ignoreByWatcher(filePath, newFilePath);
+ PlatformIO.ignoreByWatcher(path, newPath);
- return nativeAPI.renameFilePromise(filePath, newFilePath).then(result => {
- PlatformIO.deignoreByWatcher(filePath, newFilePath);
+ return nativeAPI.renameFilePromise(path, newPath).then(result => {
+ PlatformIO.deignoreByWatcher(path, newPath);
return result;
});
};
diff --git a/app/utils/paths.ts b/app/utils/paths.ts
index 3026cf43b..fecc06d65 100644
--- a/app/utils/paths.ts
+++ b/app/utils/paths.ts
@@ -114,7 +114,8 @@ export function getFileLocationFromMetaFile(
export function getThumbFileLocationForFile(
entryPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
+ dirSeparator: string, // = AppConfig.dirSeparator
+ encode: boolean = true
) {
if (entryPath.indexOf(dirSeparator + AppConfig.metaFolder) > -1) {
// entryPath is in .ts folder - no thumb file location exist
@@ -124,11 +125,16 @@ export function getThumbFileLocationForFile(
entryPath,
dirSeparator
);
+ const fileName = extractFileName(entryPath, dirSeparator);
const metaFolder = getMetaDirectoryPath(containingFolder, dirSeparator);
return (
metaFolder +
dirSeparator +
- encodeURIComponent(extractFileName(entryPath, dirSeparator)) +
+ (encode
+ ? encodeURIComponent(fileName)
+ .replace(/%5B/g, '[')
+ .replace(/%5D/g, ']')
+ : fileName) +
AppConfig.thumbFileExt
);
}
diff --git a/package.json b/package.json
index d0be0f0d1..ae7e4a6ac 100644
--- a/package.json
+++ b/package.json
@@ -149,7 +149,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
"@material-ui/pickers": "^3.2.10",
- "@tagspaces/tagspaces-platforms": "1.0.62",
+ "@tagspaces/tagspaces-platforms": "1.0.64",
"aws-amplify": "^3.3.27",
"aws-sdk": "^2.984.0",
"babel-polyfill": "^6.26.0",
diff --git a/yarn.lock b/yarn.lock
index edf18a871..7f8abb093 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3389,10 +3389,10 @@
dependencies:
defer-to-connect "^1.0.1"
-"@tagspaces/[email protected]":
- version "1.0.62"
- resolved "https://registry.yarnpkg.com/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-1.0.62.tgz#4fb1951d703a6a8f260ee2b22c4e3feef9d0ba73"
- integrity sha512-K+8j4u4P9pDqNmILPBzGzaDYaQczt7CGgk2mjqvw2guWAJx+kFLPNqPr4DlJbz9vTsemKCLHoONnuGEuTEkUlw==
+"@tagspaces/[email protected]":
+ version "1.0.64"
+ resolved "https://registry.yarnpkg.com/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-1.0.64.tgz#4a6c703bc140ca0da65e3dd11f1d9d492049a853"
+ integrity sha512-KdnFkbckYB29xq3GluNTeqbxGFKQdNFrONp0vwdbLhCQbPGAS0/bgUqibD5RszYe13VBvOn3y5hOTDtuRoeCrA==
"@testim/chrome-version@^1.0.7":
version "1.0.7"