Handle non-existent blob in UserMetadataReplacer

Fixes #720.
pull/727/head
Andrew Gaul 2024-11-18 10:37:36 -08:00
rodzic a3125c4ee3
commit 48c04eca6a
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -73,6 +73,10 @@ final class UserMetadataReplacerBlobStore extends ForwardingBlobStore {
@Override
public BlobMetadata blobMetadata(String container, String name) {
var blobMetadata = super.blobMetadata(container, name);
if (blobMetadata == null) {
return null;
}
var metadata = ImmutableMap.<String, String>builder();
// TODO: duplication
for (var entry : blobMetadata.getUserMetadata().entrySet()) {
@ -92,6 +96,10 @@ final class UserMetadataReplacerBlobStore extends ForwardingBlobStore {
public Blob getBlob(String containerName, String name,
GetOptions getOptions) {
var blob = super.getBlob(containerName, name, getOptions);
if (blob == null) {
return null;
}
var metadata = ImmutableMap.<String, String>builder();
for (var entry : blob.getMetadata().getUserMetadata().entrySet()) {
metadata.put(replaceChars(entry.getKey(), toChars, fromChars),