Skip to content

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

fix package-web

sytolkc96b0cb3147c
diff --git a/app/package.json b/app/package.json
index 2b9b727fe..ad6a41916 100644
--- a/app/package.json
+++ b/app/package.json
@@ -16,7 +16,7 @@
"@tagspaces/extensions": "1.0.35"
},
"nodeDependencies": {
- "@tagspaces/tagspaces-ws": "2.0.43",
+ "@tagspaces/tagspaces-ws": "2.0.45",
"@tagspaces/extensions": "1.0.35",
"sharp": "^0.30.7"
}
diff --git a/app/reducers/io-actions.ts b/app/reducers/io-actions.ts
index 4b5de45a5..42c191fa2 100644
--- a/app/reducers/io-actions.ts
+++ b/app/reducers/io-actions.ts
@@ -354,69 +354,62 @@ const actions = {
// TODO try to replace this with <input type="file"
if (AppConfig.isElectron) {
// for AWS location getFileContentPromise cannot load with io-objectore
- return import('fs-extra').then(fs => {
- try {
- const fileContent = fs.readFileSync(job[0]);
- return PlatformIO.getPropertiesPromise(filePath)
- .then(entryProps => {
- if (entryProps) {
- dispatch(
- AppActions.showNotification(
- 'File with the same name already exist, importing skipped!',
- 'warning',
- true
- )
- );
- dispatch(AppActions.setProgress(filePath, -1, undefined));
- } else {
- // dispatch(AppActions.setProgress(filePath, progress));
- return PlatformIO.saveBinaryFilePromise(
- filePath,
- fileContent,
- true,
- onUploadProgress
+ return PlatformIO.getLocalFileContentPromise(job[0]).then(fileContent =>
+ PlatformIO.getPropertiesPromise(filePath)
+ .then(entryProps => {
+ if (entryProps) {
+ dispatch(
+ AppActions.showNotification(
+ 'File with the same name already exist, importing skipped!',
+ 'warning',
+ true
)
- .then((fsEntry: TS.FileSystemEntry) => {
- // handle meta files
- if (fileType === 'meta') {
- try {
- // eslint-disable-next-line no-param-reassign
- fsEntry.meta = loadJSONString(
- fileContent.toString()
- );
- } catch (e) {
- console.debug('cannot parse entry meta');
- }
- } else if (fileType === 'thumb') {
+ );
+ dispatch(AppActions.setProgress(filePath, -1, undefined));
+ } else {
+ // dispatch(AppActions.setProgress(filePath, progress));
+ return PlatformIO.saveBinaryFilePromise(
+ filePath,
+ fileContent,
+ true,
+ onUploadProgress
+ )
+ .then((fsEntry: TS.FileSystemEntry) => {
+ // handle meta files
+ if (fileType === 'meta') {
+ try {
// eslint-disable-next-line no-param-reassign
- fsEntry.thumbPath = fsEntry.path;
+ fsEntry.meta = loadJSONString(fileContent.toString());
+ } catch (e) {
+ console.debug('cannot parse entry meta');
}
+ } else if (fileType === 'thumb') {
+ // eslint-disable-next-line no-param-reassign
+ fsEntry.thumbPath = fsEntry.path;
+ }
- return fsEntry;
- })
- .catch(err => {
- console.error(
- 'Importing file ' + filePath + ' failed ' + err
- );
- dispatch(
- AppActions.showNotification(
- 'Importing file ' + filePath + ' failed.',
- 'error',
- true
- )
- );
- return undefined;
- });
- }
- return undefined;
- })
- .catch(err => {
- console.log('Error getting properties ' + err);
- });
- } catch (ex) {
- console.warn('Error readFileSync for ' + job[0], ex);
- }
- });
+ return fsEntry;
+ })
+ .catch(err => {
+ console.error(
+ 'Importing file ' + filePath + ' failed ' + err
+ );
+ dispatch(
+ AppActions.showNotification(
+ 'Importing file ' + filePath + ' failed.',
+ 'error',
+ true
+ )
+ );
+ return undefined;
+ });
+ }
+ return undefined;
+ })
+ .catch(err => {
+ console.log('Error getting properties ' + err);
+ })
+ );
}
return undefined;
diff --git a/app/services/platform-facade.ts b/app/services/platform-facade.ts
index ec48f03ca..5ae8d063b 100644
--- a/app/services/platform-facade.ts
+++ b/app/services/platform-facade.ts
@@ -49,6 +49,7 @@ import {
platformGetPropertiesPromise,
platformLoadTextFilePromise,
platformGetFileContentPromise,
+ platformGetLocalFileContentPromise,
platformSaveTextFilePromise,
platformSaveBinaryFilePromise,
platformCreateDirectoryPromise,
@@ -347,6 +348,11 @@ export default class PlatformFacade {
type?: string
): Promise<any> => platformGetFileContentPromise(filePath, type);
+ static getLocalFileContentPromise = (
+ filePath: string,
+ type?: string
+ ): Promise<any> => platformGetLocalFileContentPromise(filePath, type);
+
static saveFilePromise = (
filePath: string,
content: any,
diff --git a/package.json b/package.json
index b0ecbcde4..a6e89de23 100644
--- a/package.json
+++ b/package.json
@@ -156,8 +156,8 @@
"@mui/lab": "^5.0.0-alpha.92",
"@mui/material": "^5.9.2",
"@mui/styles": "^5.9.2",
- "@tagspaces/tagspaces-md": "2.0.34",
- "@tagspaces/tagspaces-platforms": "2.0.43",
+ "@tagspaces/tagspaces-md": "2.0.45",
+ "@tagspaces/tagspaces-platforms": "2.0.45",
"aws-amplify": "^4.3.8",
"aws-sdk": "^2.1036.0",
"babel-polyfill": "^6.26.0",