Merge pull request #36 from ByronLudwig/fix/nosuchversion-error-code

fix: return NoSuchVersion error for non-existent versionId
This commit is contained in:
Fred Peña authored and GitHub committed 2026-03-24 12:16:23 -04:00
commit ab4648bd01
2 files changed
+14 -1

No files matched your search

@@ -248,7 +248,9 @@ public class S3Service {
}
S3Object obj = objectStore.get(storeKey)
.orElseThrow(() -> new AwsException("NoSuchKey", "The specified key does not exist.", 404));
.orElseThrow(() -> versionId != null
? new AwsException("NoSuchVersion", "The specified version does not exist.", 404)
: new AwsException("NoSuchKey", "The specified key does not exist.", 404));
if (obj.isDeleteMarker()) {
throw new AwsException("NoSuchKey", "The specified key does not exist.", 404);