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

Android: Fix crash when attaching certain files

This commit is contained in:
Laurent Cozic
2018-10-07 18:55:49 +01:00
parent ea516301fd
commit 44986a35a4
10 changed files with 56 additions and 54 deletions

View File

@@ -27,7 +27,7 @@ const { globalStyle, themeStyle } = require('lib/components/global-style.js');
const { dialogs } = require('lib/dialogs.js');
const DialogBox = require('react-native-dialogbox').default;
const { NoteBodyViewer } = require('lib/components/note-body-viewer.js');
const RNFetchBlob = require('react-native-fetch-blob').default;
const RNFetchBlob = require('rn-fetch-blob').default;
const { DocumentPicker, DocumentPickerUtil } = require('react-native-document-picker');
const ImageResizer = require('react-native-image-resizer').default;
const shared = require('lib/components/shared/note-screen-shared.js');
@@ -340,6 +340,7 @@ class NoteScreenComponent extends BaseScreenComponent {
const localFilePath = pickerResponse.uri;
let mimeType = pickerResponse.type;
if (!mimeType) {
const ext = fileExtension(localFilePath);
mimeType = mimeUtils.fromFileExtension(ext);
@@ -375,7 +376,8 @@ class NoteScreenComponent extends BaseScreenComponent {
dialogs.error(this, _('Unsupported image type: %s', mimeType));
return;
} else {
await RNFetchBlob.fs.cp(localFilePath, targetPath);
await shim.fsDriver().copy(localFilePath, targetPath);
const stat = await shim.fsDriver().stat(targetPath);
if (stat.size >= 10000000) {
await shim.fsDriver().remove(targetPath);

View File

@@ -13,7 +13,7 @@ class GeolocationNode {
response = await response.json();
if (!('lat' in response) || !('lon' in response)) throw new Error('Invalid geolocation response: ' . JSON.stringify(response));
if (!('lat' in response) || !('lon' in response)) throw new Error('Invalid geolocation response: ' . (response ? JSON.stringify(response) : '<null>'));
return {
timestamp: (new Date()).getTime(),

View File

@@ -1,7 +1,7 @@
const { shim } = require('lib/shim.js');
const { GeolocationReact } = require('lib/geolocation-react.js');
const { PoorManIntervals } = require('lib/poor-man-intervals.js');
const RNFetchBlob = require('react-native-fetch-blob').default;
const RNFetchBlob = require('rn-fetch-blob').default;
const { generateSecureRandom } = require('react-native-securerandom');
const FsDriverRN = require('lib/fs-driver-rn.js').FsDriverRN;
const urlValidator = require('valid-url');

View File

@@ -478,7 +478,7 @@ class Synchronizer {
break;
}
this.logSyncOperation("fetchingProcessed", null, null, "Processing fetched item");
// this.logSyncOperation("fetchingProcessed", null, null, "Processing fetched item");
let remote = remotes[i];
if (!BaseItem.isSystemPath(remote.path)) continue; // The delta API might return things like the .sync, .resource or the root folder