webdav: return forbidden on failed proppatch #94
+12
−1
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.
Some file systems do not allow opening directories with a write flag.
The PROPPATCH implementation always opens all files it tries to patch
with O_RDWR. When running on Linux with the Dir implementation of
FileSystem, this leads to all PROPPATCH calls to a directory failing
with an Internal Server Error.
Some clients, such as git via the Microsoft Mini Redirector try to patch
directories' properties. A server using a Dir FileSystem fails in this
situation, which makes it unusable for that entire class of clients.
Rather than failing with a Internal Server Error we can instead return
Forbidden, which indicates to the client that it's not allowed to patch
properties on that file. This patch does so if we fail to open the file,
and the error is because of a lack of permission, or because the file is
a directory. We don't unconditionally return Forbidden in this case
because other errors are more likey to be ephemeral: a client retrying
could possibly succeed in a subsequent patch.
Fixes golang/go#43929