* Fix: Support object tagging in versioned buckets (Issue #7868) This fix addresses the issue where setting tags on files in versioned buckets would fail with 'filer: no entry is found in filer store' error. Changes: - Updated GetObjectTaggingHandler to check versioning status and retrieve correct object versions - Updated PutObjectTaggingHandler to properly locate and update tags on versioned objects - Updated DeleteObjectTaggingHandler to delete tags from versioned objects - Added proper handling for both specific versions and latest versions - Added distinction between null versions (pre-versioning objects) and versioned objects The fix follows the same versioning-aware pattern already implemented in ACL handlers. Tests: - Added comprehensive test suite for tagging operations on versioned buckets - Tests cover PUT, GET, and DELETE tagging operations on specific versions and latest versions - Tests verify tag isolation between different versions of the same object * Fix: Ensure consistent directory path construction in tagging handlers Changed directory path construction to match the pattern used in ACL handlers: - Added missing '/' before object path when constructing .versions directory path - This ensures compatibility with the filer's expected path structure - Applied to both PutObjectTaggingHandler and DeleteObjectTaggingHandler * Revert: Remove redundant slash in path construction - object already has leading slash from NormalizeObjectKey * Fix: Remove redundant slashes in versioning path construction across handlers - getVersionedObjectDir: object already starts with '/', no need for extra '/' - ACL handlers: same pattern, fix both PutObjectAcl locations - Ensures consistent path construction with object parameter normalization * fix test compilation * Add: Comprehensive ACL tests for versioned and non-versioned buckets - Added s3_acl_versioning_test.go with 5 test cases covering: * GetObjectAcl on versioned buckets * GetObjectAcl on specific versions * PutObjectAcl on versioned buckets * PutObjectAcl on specific versions * Independent ACL management across versions These tests were missing and would have caught the path construction issues we just fixed in the ACL handler. Tests validate that ACL operations work correctly on both versioned and non-versioned objects. * Fix: Correct tagging versioning test file formatting * fix: Update AWS SDK endpoint config and improve cleanup to handle delete markers - Replace deprecated EndpointResolverWithOptions with BaseEndpoint in AWS SDK v2 client configuration - Update cleanupTestBucket to properly delete both object versions and delete markers - Apply changes to both ACL and tagging test files for consistency * Fix S3 multi-delete for versioned objects The bug was in getVersionedObjectDir() which was constructing paths without a slash between the bucket and object key: BEFORE (WRONG): /buckets/mybucket{key}.versions AFTER (FIXED): /buckets/mybucket/{key}/.versions This caused version deletions to claim success but not actually delete files, breaking S3 compatibility tests: - test_versioning_multi_object_delete - test_versioning_multi_object_delete_with_marker - test_versioning_concurrent_multi_object_delete - test_object_lock_multi_delete_object_with_retention Added comprehensive test that reproduces the issue and verifies the fix. * Remove emojis from test output
S3 Object Tagging Tests
This directory contains tests for S3 object tagging functionality.
Issue Reference
These tests were created to verify the fix for GitHub Issue #7589: S3 object Tags query comes back empty
Problem Description
When uploading an object with tags using the X-Amz-Tagging header, the tags were not being stored.
When querying the object tagging with GetObjectTagging, the response was empty.
This was a regression between SeaweedFS 4.00 and 4.01.
Root Cause
The putToFiler function in s3api_object_handlers_put.go was not parsing the X-Amz-Tagging header
and storing the tags in the entry's Extended metadata. The code was only copying user metadata
(headers starting with X-Amz-Meta-) but not object tags.
Fix
Added tag parsing logic to putToFiler that:
- Reads the
X-Amz-Taggingheader - Parses it using
url.ParseQuery()for proper URL decoding - Stores each tag with the prefix
X-Amz-Tagging-in the entry's Extended metadata
Running Tests
# Run all tagging tests
cd test/s3/tagging
make test
# Run specific test
make test-upload
# Or using go test directly
go test -v ./...
Test Cases
- TestObjectTaggingOnUpload - Basic test for tags sent during object upload
- TestObjectTaggingOnUploadWithSpecialCharacters - Tests URL-encoded tag values
- TestObjectTaggingOnUploadWithEmptyValue - Tests tags with empty values
- TestPutObjectTaggingAPI - Tests the PutObjectTagging API separately
- TestDeleteObjectTagging - Tests tag deletion
- TestTagsNotPreservedAfterObjectOverwrite - Verifies AWS S3 behavior on overwrite
- TestMaximumNumberOfTags - Tests storing the maximum 10 tags
- TestTagCountHeader - Tests the x-amz-tagging-count header in HeadObject