Skip to content

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

fix: issue with uploading files on wasabi s3 service

Ilian Sapundshiev54451c2dd89b
diff --git a/app/reducers/io-actions.ts b/app/reducers/io-actions.ts
index a8a229f0f..1753c04d9 100644
--- a/app/reducers/io-actions.ts
+++ b/app/reducers/io-actions.ts
@@ -214,11 +214,11 @@ const actions = {
reader.onload = async (event: any) => {
await readerLoaded(event, inx, filePath);
};
- if (AppConfig.isWeb && PlatformIO.isMinio()) {
- reader.readAsBinaryString(file);
- } else {
- reader.readAsArrayBuffer(file);
- }
+ // if (AppConfig.isWeb && PlatformIO.isMinio()) {
+ // reader.readAsBinaryString(file);
+ // } else {
+ reader.readAsArrayBuffer(file);
+ // }
/* else if (AppConfig.isCordova) {
reader.readAsDataURL(file);
} */
@@ -240,24 +240,28 @@ const actions = {
const result = event.currentTarget
? event.currentTarget.result
: event.target.result;
- const fsEntry: TS.FileSystemEntry = await PlatformIO.saveBinaryFilePromise(
- fileTargetPath,
- result,
- true,
- onUploadProgress
- );
- if (fsEntry) {
- dispatch(
- AppActions.showNotification(
- 'File ' + fileTargetPath + ' successfully imported.',
- 'default',
- true
- )
+ try {
+ const fsEntry: TS.FileSystemEntry = await PlatformIO.saveBinaryFilePromise(
+ fileTargetPath,
+ result,
+ true,
+ onUploadProgress
+ );
+ if (fsEntry) {
+ dispatch(
+ AppActions.showNotification(
+ 'File ' + fileTargetPath + ' successfully imported.',
+ 'default',
+ true
+ )
+ );
+ fsEntries.push(fsEntry);
+ // dispatch(AppActions.reflectCreateEntry(fileTargetPath, true));
+ }
+ } catch (error) {
+ console.error(
+ 'Uploading ' + fileTargetPath + ' failed with ' + error
);
- fsEntries.push(fsEntry);
- // dispatch(AppActions.reflectCreateEntry(fileTargetPath, true));
- } else {
- console.error('Save to file ' + fileTargetPath + ' failed ');
dispatch(
AppActions.showNotification(
'Importing file ' + fileTargetPath + ' failed.',