Skip to content

Commit

Permalink
Add cos
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Nov 14, 2024
1 parent 04b7616 commit 036ead0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/services/cos/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ impl Access for CosBackend {
write_with_content_type: true,
write_with_cache_control: true,
write_with_content_disposition: true,
// TODO: set this to false while version has been enabled.
write_with_if_not_exists: true,
// The min multipart size of COS is 1 MiB.
//
// ref: <https://www.tencentcloud.com/document/product/436/14112>
Expand Down
12 changes: 12 additions & 0 deletions core/src/services/cos/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ impl CosCore {
req = req.header(CONTENT_TYPE, mime)
}

// For a bucket which has never enabled versioning, you may use it to
// specify whether to prohibit overwriting the object with the same name
// when uploading the object:
//
// When the x-cos-forbid-overwrite is specified as true, overwriting the object
// with the same name will be prohibited.
//
// ref: https://www.tencentcloud.com/document/product/436/7749
if args.if_not_exists() {
req = req.header("x-cos-forbid-overwrite", "true")
}

let req = req.body(body).map_err(new_request_build_error)?;

Ok(req)
Expand Down

0 comments on commit 036ead0

Please sign in to comment.