1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-13 22:12:50 +02:00

All: For now, disable attaching resources larger than 10MB due to #371

This commit is contained in:
Laurent Cozic
2018-05-03 11:31:07 +01:00
parent 4c210d0956
commit 80b467eead
3 changed files with 10 additions and 0 deletions

View File

@@ -530,6 +530,7 @@ class NoteTextComponent extends React.Component {
});
} catch (error) {
reg.logger().error(error);
bridge().showErrorMessageBox(error.message);
}
}
}

View File

@@ -364,10 +364,16 @@ class NoteScreenComponent extends BaseScreenComponent {
return;
} else {
await RNFetchBlob.fs.cp(localFilePath, targetPath);
const stat = await shim.fsDriver().stat(targetPath);
if (stat.size >= 10000000) {
await shim.fsDriver().remove(targetPath);
throw new Error('Resources larger than 10 MB are not currently supported as they may crash the mobile applications. The issue is being investigated and will be fixed at a later time.');
}
}
}
} catch (error) {
reg.logger().warn('Could not attach file:', error);
await dialogs.error(this, error.message);
return;
}

View File

@@ -111,6 +111,9 @@ function shimInit() {
if (resource.mime == 'image/jpeg' || resource.mime == 'image/jpg' || resource.mime == 'image/png') {
const result = await resizeImage_(filePath, targetPath, resource.mime);
} else {
const stat = await shim.fsDriver().stat(filePath);
if (stat.size >= 10000000) throw new Error('Resources larger than 10 MB are not currently supported as they may crash the mobile applications. The issue is being investigated and will be fixed at a later time.');
await fs.copy(filePath, targetPath, { overwrite: true });
}