mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Android: Fix crash when attaching certain files
This commit is contained in:
parent
ea516301fd
commit
44986a35a4
@ -148,7 +148,7 @@ dependencies {
|
||||
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
compile project(':react-native-sqlite-storage')
|
||||
compile project(':react-native-fetch-blob')
|
||||
compile project(':rn-fetch-blob')
|
||||
compile project(':react-native-document-picker')
|
||||
compile project(':react-native-image-resizer')
|
||||
compile project(':react-native-share-extension')
|
||||
|
@ -21,8 +21,8 @@ include ':app'
|
||||
include ':react-native-sqlite-storage'
|
||||
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')
|
||||
|
||||
include ':react-native-fetch-blob'
|
||||
project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')
|
||||
include ':rn-fetch-blob'
|
||||
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
|
||||
|
||||
include ':react-native-document-picker'
|
||||
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android')
|
||||
|
@ -435,7 +435,7 @@
|
||||
9D8705D0D07C4A098FD912EB /* RNFS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFS.xcodeproj; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = "<group>"; };
|
||||
A4716DB8654B431D894F89E1 /* RNImagePicker.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNImagePicker.xcodeproj; path = "../node_modules/react-native-image-picker/ios/RNImagePicker.xcodeproj"; sourceTree = "<group>"; };
|
||||
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
|
||||
B8C44254005A4B80AD5CA558 /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = "<group>"; };
|
||||
B8C44254005A4B80AD5CA558 /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/rn-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = "<group>"; };
|
||||
C77F905EF22646F39B673572 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = "<group>"; };
|
||||
CC3CF4044A914711B8D30D1A /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; };
|
||||
CCDC2774CD86466F897D88E2 /* libRNFileViewer.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFileViewer.a; sourceTree = "<group>"; };
|
||||
@ -1371,7 +1371,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker",
|
||||
"$(SRCROOT)/../node_modules/react-native-fetch-blob/ios/**",
|
||||
"$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**",
|
||||
"$(SRCROOT)/../node_modules/react-native-fs/**",
|
||||
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
|
||||
"$(SRCROOT)/../node_modules/react-native-sqlite-storage/src/ios",
|
||||
@ -1413,7 +1413,7 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-document-picker/ios/RNDocumentPicker",
|
||||
"$(SRCROOT)/../node_modules/react-native-fetch-blob/ios/**",
|
||||
"$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**",
|
||||
"$(SRCROOT)/../node_modules/react-native-fs/**",
|
||||
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
|
||||
"$(SRCROOT)/../node_modules/react-native-sqlite-storage/src/ios",
|
||||
|
@ -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);
|
||||
|
@ -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(),
|
||||
|
@ -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');
|
||||
|
@ -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
|
||||
|
80
ReactNativeClient/package-lock.json
generated
80
ReactNativeClient/package-lock.json
generated
@ -929,7 +929,7 @@
|
||||
},
|
||||
"ansi-colors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
|
||||
"integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==",
|
||||
"requires": {
|
||||
"ansi-wrap": "^0.1.0"
|
||||
@ -2723,14 +2723,14 @@
|
||||
"dependencies": {
|
||||
"kind-of": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz",
|
||||
"integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"external-editor": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
|
||||
"integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
|
||||
"requires": {
|
||||
"chardet": "^0.4.0",
|
||||
@ -3684,7 +3684,7 @@
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
||||
"requires": {
|
||||
"depd": "~1.1.2",
|
||||
@ -4788,7 +4788,7 @@
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
@ -5824,7 +5824,7 @@
|
||||
},
|
||||
"opn": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/opn/-/opn-3.0.3.tgz",
|
||||
"resolved": "http://registry.npmjs.org/opn/-/opn-3.0.3.tgz",
|
||||
"integrity": "sha1-ttmec5n3jWXDuq/+8fsojpuFJDo=",
|
||||
"requires": {
|
||||
"object-assign": "^4.0.1"
|
||||
@ -5994,7 +5994,7 @@
|
||||
},
|
||||
"pegjs": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz",
|
||||
"resolved": "http://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz",
|
||||
"integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0="
|
||||
},
|
||||
"performance-now": {
|
||||
@ -6108,7 +6108,7 @@
|
||||
},
|
||||
"pretty-format": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-4.3.1.tgz",
|
||||
"resolved": "http://registry.npmjs.org/pretty-format/-/pretty-format-4.3.1.tgz",
|
||||
"integrity": "sha1-UwvlxCs8BbNkFKeipDN6qArNDo0="
|
||||
},
|
||||
"private": {
|
||||
@ -6600,39 +6600,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-native-fetch-blob": {
|
||||
"version": "0.10.8",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fetch-blob/-/react-native-fetch-blob-0.10.8.tgz",
|
||||
"integrity": "sha1-T8JWq64MtfEOfEHyjBGz/zMNcqk=",
|
||||
"requires": {
|
||||
"base-64": "0.1.0",
|
||||
"glob": "7.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz",
|
||||
"integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=",
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.2",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"react-native-file-viewer": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/react-native-file-viewer/-/react-native-file-viewer-1.0.5.tgz",
|
||||
"integrity": "sha512-/5lwmVPliEOIJMoRby9tb1s9VPxUH1ru7BfdCKxZAwZI5LoOY1qHZuUMtCHAlIKLH1DHu8fhjleJuXbRHaCuLQ=="
|
||||
},
|
||||
"react-native-fs": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.8.5.tgz",
|
||||
"integrity": "sha512-MhiXXAaObI0aVuiu1i0NMaSpmzdjafGdhowJyhvbqiMeDLDH3UktxebW/sINUEsT6CmJz/DUK497DAesdyAaBw==",
|
||||
"version": "2.11.17",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.11.17.tgz",
|
||||
"integrity": "sha512-shAiRMBJYuialBTXkpZ6jE629tRAmt85YQhjSSM3XhlBJ5bo5T3Wu6W/8BK3ve4M6h2Uc3tjUfyCY1NksLShGg==",
|
||||
"requires": {
|
||||
"base-64": "^0.1.0",
|
||||
"utf8": "^2.1.1"
|
||||
@ -7033,7 +7009,7 @@
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
@ -7273,6 +7249,30 @@
|
||||
"glob": "^7.0.5"
|
||||
}
|
||||
},
|
||||
"rn-fetch-blob": {
|
||||
"version": "0.10.13",
|
||||
"resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.10.13.tgz",
|
||||
"integrity": "sha512-CEz7coPlMMUpX5RB+k7Mqzq+eYYfZuFbpuNkFYhvEFnT5DnZyqdNF50Xk6BuZyqZwAjNvsQ1CUMz7XDvuN10DA==",
|
||||
"requires": {
|
||||
"base-64": "0.1.0",
|
||||
"glob": "7.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz",
|
||||
"integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=",
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.2",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rsvp": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.6.2.tgz",
|
||||
@ -8148,7 +8148,7 @@
|
||||
"dependencies": {
|
||||
"rimraf": {
|
||||
"version": "2.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz",
|
||||
"resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz",
|
||||
"integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI="
|
||||
}
|
||||
}
|
||||
@ -8174,7 +8174,7 @@
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||
},
|
||||
"through2": {
|
||||
@ -8733,7 +8733,7 @@
|
||||
"dependencies": {
|
||||
"uuid": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz",
|
||||
"resolved": "http://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz",
|
||||
"integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE="
|
||||
}
|
||||
}
|
||||
@ -8785,7 +8785,7 @@
|
||||
"dependencies": {
|
||||
"sax": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.1.6.tgz",
|
||||
"resolved": "http://registry.npmjs.org/sax/-/sax-1.1.6.tgz",
|
||||
"integrity": "sha1-XWFr6KXmB9VOEUr65Vt+ry/MMkA="
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,8 @@
|
||||
"react-native-dialogbox": "^0.6.6",
|
||||
"react-native-document-picker": "^2.1.0",
|
||||
"react-native-dropdownalert": "^3.1.2",
|
||||
"react-native-fetch-blob": "^0.10.6",
|
||||
"react-native-file-viewer": "^1.0.5",
|
||||
"react-native-fs": "^2.8.5",
|
||||
"react-native-fs": "^2.11.17",
|
||||
"react-native-image-picker": "^0.26.7",
|
||||
"react-native-image-resizer": "^1.0.0",
|
||||
"react-native-material-dropdown": "^0.5.2",
|
||||
@ -47,6 +46,7 @@
|
||||
"react-navigation": "^1.0.0-beta.21",
|
||||
"react-redux": "5.0.7",
|
||||
"redux": "4.0.0",
|
||||
"rn-fetch-blob": "^0.10.13",
|
||||
"stream": "0.0.2",
|
||||
"string-natural-compare": "^2.0.2",
|
||||
"string-padding": "^1.0.2",
|
||||
|
@ -45,7 +45,7 @@ const { SideMenuContent } = require('lib/components/side-menu-content.js');
|
||||
const { DatabaseDriverReactNative } = require('lib/database-driver-react-native');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { _, setLocale, closestSupportedLocale, defaultLocale } = require('lib/locale.js');
|
||||
const RNFetchBlob = require('react-native-fetch-blob').default;
|
||||
const RNFetchBlob = require('rn-fetch-blob').default;
|
||||
const { PoorManIntervals } = require('lib/poor-man-intervals.js');
|
||||
const { reducer, defaultState } = require('lib/reducer.js');
|
||||
const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
|
||||
|
Loading…
Reference in New Issue
Block a user