Skip to content

Commit 3943192

Browse files
committed
All: Fixes #808 (maybe): Added fix for Nginx 404 error issue.
1 parent 18d7680 commit 3943192

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ReactNativeClient/lib/WebDavApi.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ class WebDavApi {
322322

323323
const output = await loadResponseJson();
324324

325+
// Trying to fix 404 error issue with Nginx WebDAV server.
326+
// https://github.com/laurent22/joplin/issues/624
327+
// https://github.com/laurent22/joplin/issues/808
328+
// Not tested but someone confirmed it worked - https://github.com/laurent22/joplin/issues/808#issuecomment-443552858
329+
// and fix is narrowly scoped so shouldn't affect anything outside this particular edge case.
330+
const responseArray = this.arrayFromJson(output, ['d:multistatus', 'd:response']);
331+
if (responseArray && responseArray.length === 1) {
332+
const status = this.stringFromJson(output, ['d:multistatus', 'd:response', 0, 'd:propstat', 0, 'd:status', 0]);
333+
if (status && status.indexOf('404') >= 0) throw newError('Not found', 404);
334+
}
335+
325336
// Check that we didn't get for example an HTML page (as an error) instead of the JSON response
326337
// null responses are possible, for example for DELETE calls
327338
if (output !== null && typeof output === 'object' && !('d:multistatus' in output)) throw newError('Not a valid WebDAV response');

0 commit comments

Comments
 (0)