mirror of https://github.com/laurent22/joplin.git
All: Fixes #799: Handle restricted_content error for Dropbox
parent
4e8372174b
commit
e7a9f630ec
ReactNativeClient/lib
|
@ -159,12 +159,20 @@ class FileApiDriverDropbox {
|
||||||
// See https://github.com/facebook/react-native/issues/14445#issuecomment-352965210
|
// See https://github.com/facebook/react-native/issues/14445#issuecomment-352965210
|
||||||
if (typeof content === 'string') content = shim.Buffer.from(content, 'utf8')
|
if (typeof content === 'string') content = shim.Buffer.from(content, 'utf8')
|
||||||
|
|
||||||
|
try {
|
||||||
await this.api().exec('POST', 'files/upload', content, {
|
await this.api().exec('POST', 'files/upload', content, {
|
||||||
'Dropbox-API-Arg': JSON.stringify({
|
'Dropbox-API-Arg': JSON.stringify({
|
||||||
path: this.makePath_(path),
|
path: this.makePath_(path),
|
||||||
mode: 'overwrite',
|
mode: 'overwrite',
|
||||||
mute: true, // Don't send a notification to user since there can be many of these updates
|
mute: true, // Don't send a notification to user since there can be many of these updates
|
||||||
})}, options);
|
})}, options);
|
||||||
|
} catch (error) {
|
||||||
|
if (this.hasErrorCode_(error, 'restricted_content')) {
|
||||||
|
throw new JoplinError('Cannot upload because content is restricted by Dropbox', 'rejectedByTarget');
|
||||||
|
} else {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(path) {
|
async delete(path) {
|
||||||
|
|
Loading…
Reference in New Issue