0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/spec/lib/file_store
discoursebot f88b8222db
FIX: Set tagging_directive to "REPLACE" in S3Helper#copy [backport 2026.1] (#37887)
Backport of #37710 to release/2026.1.

---

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.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2026-02-18 18:21:55 +11:00
..
base_store_spec.rb DEV: Add both safe and unsafe Discourse.store.download methods (#21498) 2023-05-11 17:27:27 +08:00
local_store_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
s3_store_spec.rb FIX: Set tagging_directive to "REPLACE" in S3Helper#copy [backport 2026.1] (#37887) 2026-02-18 18:21:55 +11:00