Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
Open
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
12 changes: 9 additions & 3 deletions src/main/java/com/upplication/s3fs/util/S3Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ public S3ObjectSummary getS3ObjectSummary(S3Path s3Path) throws NoSuchFileExcept
result.setKey(key);
result.setLastModified(metadata.getLastModified());
result.setSize(metadata.getContentLength());
AccessControlList objectAcl = client.getObjectAcl(bucketName, key);
result.setOwner(objectAcl.getOwner());
try {
AccessControlList objectAcl = client.getObjectAcl(bucketName, key);
result.setOwner(objectAcl.getOwner());
} catch (AmazonS3Exception e) {
// If we don't have permission to view the ACL, that's fine, we can leave `owner` empty
if (e.getStatusCode() != 403)
throw e;
}
return result;
} catch (AmazonS3Exception e) {
if (e.getStatusCode() != 404)
Expand Down Expand Up @@ -189,4 +195,4 @@ public S3BasicFileAttributes toS3FileAttributes(S3ObjectSummary objectSummary, S
}
return new S3BasicFileAttributes(resolvedKey, lastModifiedTime, size, directory, regularFile);
}
}
}