Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changes-entries/pr60746.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*) mod_dav_fs: Return a 404 for DELETE if deletion fails because the
resource no longer exists. PR 60746. [Joe Orton]
12 changes: 10 additions & 2 deletions modules/dav/fs/repos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,8 +1521,16 @@ static dav_error * dav_fs_remove_resource(dav_resource *resource,

/* not a collection; remove the file and its properties */
if ((status = apr_file_remove(info->pathname, info->pool)) != APR_SUCCESS) {
/* ### put a description in here */
return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, status, NULL);
if (APR_STATUS_IS_ENOENT(status)) {
/* Return a 404 if there is a race with another DELETE,
* per RFC 4918§9.6. */
return dav_new_error(info->pool, HTTP_NOT_FOUND, 0, status,
"Cannot remove already-removed resource.");
}
else {
return dav_new_error(info->pool, HTTP_FORBIDDEN, 0, status,
"Cannot remove resource");
}
}

/* update resource state */
Expand Down