TagSpaces is an offline, open source, document manager with tagging support
Tsn604 check set thumbnails on s3 (#1357)
Stanimir6c64fd9f4065
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex 6690b193d..183ca7a18 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -381,14 +381,22 @@ const EntryProperties = (props: Props) => {const setThumb = (filePath, thumbFilePath) => {if (filePath !== undefined) {+ if (PlatformIO.haveObjectStoreSupport()) {+ const thumbUrl = PlatformIO.getURLforPath(thumbFilePath);+ props.updateThumbnailUrl(currentEntry.path, thumbUrl);+ return Promise.resolve(true);+ }return replaceThumbnailURLPromise(filePath, thumbFilePath).then(objUrl => {// setThumbPath(objUrl.tmbPath);/* setCurrentEntry({- ...currentEntry,- thumbPath: objUrl.tmbPath- }); */- props.updateThumbnailUrl(currentEntry.path, objUrl.tmbPath);+ ...currentEntry,+ thumbPath: objUrl.tmbPath+ }); */+ props.updateThumbnailUrl(+ currentEntry.path,+ objUrl.tmbPath + '?' + new Date().getTime()+ );return true;}).catch(err => {@@ -554,9 +562,13 @@ const EntryProperties = (props: Props) => {PlatformIO.getDirSeparator());}- const thumbPathUrl = thumbPath- ? 'url("' + thumbPath + '?' + new Date().getTime() + '")'- : '';+ let url;+ if (PlatformIO.haveObjectStoreSupport()) {+ url = PlatformIO.getURLforPath(thumbPath);+ } else {+ url = thumbPath + '?' + new Date().getTime();+ }+ const thumbPathUrl = thumbPath ? 'url("' + url + '")' : '';// if (AppConfig.isWin) {// thumbPathUrl = thumbPathUrl.split('\\').join('\\\\');// }@@ -1214,9 +1226,9 @@ const EntryProperties = (props: Props) => {selectedFiles={[currentEntry.path]}/>)}- {ThumbnailChooserDialog && (+ {ThumbnailChooserDialog && isFileThumbChooseDialogOpened && (<ThumbnailChooserDialog- key={uuidv1()}+ // key={uuidv1()}open={isFileThumbChooseDialogOpened}onClose={toggleThumbFilesDialog}selectedFile={thumbPath}diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 04220d8e2..dc568cae3 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -1038,7 +1038,7 @@ export const actions = {updateThumbnailUrl: (filePath: string, thumbUrl: string) => ({type: types.UPDATE_THUMB_URL,filePath,- thumbUrl: thumbUrl + '?' + new Date().getTime()+ thumbUrl // + '?' + new Date().getTime()}),updateThumbnailUrls: (tmbURLs: Array<any>) => ({type: types.UPDATE_THUMB_URLS,diff --git a/app/services/thumbsgenerator.ts b/app/services/thumbsgenerator.tsindex 904f9a5f5..c46a60c39 100644--- a/app/services/thumbsgenerator.ts+++ b/app/services/thumbsgenerator.ts@@ -282,7 +282,7 @@ function generateDefaultThumbnail() {return Promise.resolve('');}-function generateImageThumbnail(fileURL): Promise<string> {+export function generateImageThumbnail(fileURL): Promise<string> {return new Promise(resolve => {let canvas: HTMLCanvasElement = document.createElement('canvas');const ctx = canvas.getContext('2d');diff --git a/app/utils/paths.ts b/app/utils/paths.tsindex 60de4e07c..56abe7586 100644--- a/app/utils/paths.ts+++ b/app/utils/paths.ts@@ -113,7 +113,7 @@ export function getThumbFileLocationForDirectory() {return (entryPath +- dirSeparator ++ (entryPath.endsWith(dirSeparator) ? '' : dirSeparator) +AppConfig.metaFolder +dirSeparator +AppConfig.folderThumbFilediff --git a/tests/e2e/perspective-grid.e2e.js b/tests/e2e/perspective-grid.e2e.jsindex 8c6829b04..b69f8bfbc 100644--- a/tests/e2e/perspective-grid.e2e.js+++ b/tests/e2e/perspective-grid.e2e.js@@ -262,7 +262,7 @@ describe('TST50 - Perspective Grid', () => {}*/});- test('TST5008 - Copy file [electron]', async () => {+ test('TST5008 - Copy file [web,minio,electron]', async () => {const sampleFileName = 'sample.txt';// Electron path: ./testdata-tmp/file-structure/supported-filestypes/empty_folderlet copyLocationPath = global.isElectron