Skip to content

Commit

Permalink
fix #14 pass ExtraArgs to upload_file
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Jan 24, 2025
1 parent 9908fcd commit f7bbb49
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# botor 0.4.1.9000 (development)

* Support passing ExtraArgs to S3 `upload_file` (#14)

# botor 0.4.1 (2025-01-23)

Maintenance release:
Expand Down
7 changes: 4 additions & 3 deletions R/s3.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ s3_read <- function(uri, fun, ..., extract = c('none', 'gzip', 'bzip2', 'xz')) {
#' @inheritParams s3_object
#' @param file string, location of local file
#' @param content_type content type of a file that is auto-guess if omitted
#' @param ... optional parameters passed to the \code{upload_file} method's \code{ExtraArgs}
#' @export
#' @importFrom checkmate assert_file_exists
#' @importFrom reticulate import
Expand All @@ -165,7 +166,7 @@ s3_read <- function(uri, fun, ..., extract = c('none', 'gzip', 'bzip2', 'xz')) {
#' unlink(t)
#' ## note that s3_write would have been a much nicer solution for the above
#' }
s3_upload_file <- function(file, uri, content_type = mime_guess(file)) {
s3_upload_file <- function(file, uri, content_type = mime_guess(file), ...) {

assert_string(file)
assert_file_exists(file)
Expand All @@ -174,9 +175,9 @@ s3_upload_file <- function(file, uri, content_type = mime_guess(file)) {

## set content type
if (!is.na(content_type)) {
extra_args <- list(ContentType = content_type)
extra_args <- list(ContentType = content_type, ...)
} else {
extra_args <- NULL
extra_args <- list(...)
}

log_trace('Uploading %s to %s ...', shQuote(file), uri)
Expand Down
2 changes: 1 addition & 1 deletion man/boto3.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7bbb49

Please sign in to comment.