dosubot[bot] commented on issue #7205: URL: https://github.com/apache/opendal/issues/7205#issuecomment-3941985316
<!-- Answer --> Thanks for the detailed bug report! I can confirm this issue exists in the codebase. The [`swift_create_object()` function](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/swift/core.rs#L107-L140) currently only handles `X-Auth-Token`, `Content-Length`, and `X-Object-Meta-*` (user metadata). It never reads `args.content_type()`, `args.content_disposition()`, `args.content_encoding()`, or `args.cache_control()` from `OpWrite`, so those headers are silently dropped. The [capability flags](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/swift/backend.rs#L155-L177) also don't declare `write_with_content_type`, `write_with_content_disposition`, etc., which correctly reflects the current behavior. For reference, the [S3 backend shows the expected pattern](https://github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/s3/core.rs#L301-L347): ```rust if let Some(mime) = args.content_type() { req = req.header(CONTENT_TYPE, mime) } if let Some(pos) = args.content_disposition() { req = req.header(CONTENT_DISPOSITION, pos) } // ... ``` A fix would involve: 1. Adding similar conditional header checks in `swift_create_object()` 2. Updating the Swift capability struct to declare these features as supported <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bc6c6b1c-6924-4552-8f2b-433467eeb591?feedback_type=other)</sup> [](https://app.dosu.dev/997a2c5a-0c54-497b-989d-44651635dd36/ask?utm_source=github) [](https://cursor.com/link/prompt?text=Thanks%20for%20the%20detailed%20bug%20report%21%20I%20can%20confirm%20this%20issue%20exists%20in%20the%20codebase.%0A%0AThe%20%5B%60swift_create_object%28%29%60%20function%5D%28https%3A//github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/swift/core.rs%23L107-L140%29%20currently%20only%20handles%20%60X-Auth-Token%60%2C%20%60Content-Length%60%2C%20and%20%60X-Object-Meta-%2A%60%20%28user%20metadata%29.%20It%20never%20reads%20%60args.content_type%28%29%60%2C%20%60args.content_disposition%28%29%60%2C%20%60args.content_encoding%28%29%60%2C%20or%20%60args.cache_control%28%29%60%20from%20%60OpWrite%60%2C%20so%20those%20headers%20are%20silently%20dropped.%0A%0AThe%20%5Bcapability%20flags%5D%28https%3A//github.com/apach e/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/swift/backend.rs%23L155-L177%29%20also%20don%27t%20declare%20%60write_with_content_type%60%2C%20%60write_with_content_disposition%60%2C%20etc.%2C%20which%20correctly%20reflects%20the%20current%20behavior.%0A%0AFor%20reference%2C%20the%20%5BS3%20backend%20shows%20the%20expected%20pattern%5D%28https%3A//github.com/apache/opendal/blob/27d5677d4526519313cbce00cd28f8fbcc099642/core/src/services/s3/core.rs%23L301-L347%29%3A%0A%0A%60%60%60rust%0Aif%20let%20Some%28mime%29%20%3D%20args.content_type%28%29%20%7B%0A%20%20%20%20req%20%3D%20req.header%28CONTENT_TYPE%2C%20mime%29%0A%7D%0Aif%20let%20Some%28pos%29%20%3D%20args.content_disposition%28%29%20%7B%0A%20%20%20%20req%20%3D%20req.header%28CONTENT_DISPOSITION%2C%20pos%29%0A%7D%0A//%20...%0A%60%60%60%0A%0AA%20fix%20would%20involve%3A%0A1.%20Adding%20similar%20conditional%20header%20checks%20in%20%60swift_create_object%28%29%60%0A2.%20Updating%20the%20Swift%20capability%2 0struct%20to%20declare%20these%20features%20as%20supported) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/opendal/issues/7205) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
