Skip to content

Commit

Permalink
Return 404 when head the file end with slash
Browse files Browse the repository at this point in the history
Cherry-pick of existing commit.
orig-pr: #18602
orig-commit: 30fc5fb
orig-commit-author: yuyang wang <[email protected]>

			pr-link: #18603
			change-id: cid-beaeba5de7ceb9b7ed0d92ad2a171f3ef8523e9d
  • Loading branch information
alluxio-bot authored May 10, 2024
1 parent 550ccc1 commit 7fefc94
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,8 @@ public Response getObjectMetadata(@PathParam("bucket") final String bucket,
URIStatus status = userFs.getStatus(objectUri);
if (status.isFolder() && !object.endsWith(AlluxioURI.SEPARATOR)) {
throw new FileDoesNotExistException(status.getPath() + " is a directory");
} else if (!status.isFolder() && object.endsWith(AlluxioURI.SEPARATOR)) {
throw new FileDoesNotExistException(status.getPath() + " is a file");
}
Response.ResponseBuilder res = Response.ok()
.lastModified(new Date(status.getLastModificationTimeMs()))
Expand Down

0 comments on commit 7fefc94

Please sign in to comment.