mirror of
https://github.com/discourse/discourse.git
synced 2026-08-03 01:49:44 -05:00
What is the problem? When `s3_enable_access_control_tags` is enabled, S3 uploads are tagged with a configurable access control tag (default key: `discourse:acl`) to indicate visibility. During multipart upload completion and file copies, `S3Helper#copy` receives a `tagging` option with the desired tags for the destination object. However, AWS S3 defaults `tagging_directive` to "COPY", which preserves the source object's tags instead of applying the new ones. This causes uploads to retain incorrect access control tags after being copied. What is the solution? Set `tagging_directive: "REPLACE"` in `S3Helper#copy` whenever `options[:tagging]` is present. This mirrors the existing `metadata_directive: "REPLACE"` pattern already used for metadata and tells the S3 API to apply the provided tags to the destination object.