Consider status
in propstat
when doing stat
#258
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
When
PROPFIND
is sent to Nginx webdav server on a non-existent file, it responds with207 Multi-Status
, but contains the404
in thestatus
element ofpropstat
. This is an example response from Nginx:The RFC 4918, Section 9.1.2. names the
404
status as valid value for thestatus
element inpropstat
, but it does not have an example with this combination (207
response status and404
in thestatus
element).Before
Before this PR, the client would treat the
PROPFIND
responses for non-existent resources from NGinx as if the resources existed. Not considering thestatus
element ofpropstat
in the response body.After
Throw error when doing
stat
on non-existent resource even if the HTTP status of the response is207
, but thestatus
inpropstat
element is>= 400
.Notes
We have been using this code at Deepnote as a package patch for couple months already without any issues, but this was still using the non-TypeScript version of this library. I have waited with creation of the PR before the TypeScript version was out (thank you very much for the TS version, very appreciated).
The same approach could in theory be applied on all
Multi-Status
responses toPROPFIND
-- I can namely think of thegetDirectoryContents
function.