Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode CopySource in operation CopyObject #819

Closed
DyfanJones opened this issue Aug 16, 2024 · 1 comment · Fixed by #820
Closed

Encode CopySource in operation CopyObject #819

DyfanJones opened this issue Aug 16, 2024 · 1 comment · Fixed by #820
Labels
bug 🐞 Something isn't working

Comments

@DyfanJones
Copy link
Member

library(paws)
client <- s3(config(credentials(profile = "paws")))

bucket = "paws-rm"
key = "rm/%01file%/output.txt"

resp <- client$put_object(
  Bucket = bucket,
  Key = key,
  Body = charToRaw("helloworld")
)

client$copy_object(
  Bucket = bucket,
  Key = "file_out_1.txt",
  CopySource = sprintf("/%s/%s", bucket, key)
)
#> Error: InvalidArgument (HTTP 400). Invalid copy source encoding

client$copy_object(
  Bucket = bucket,
  Key = "file_out_2.txt",
  CopySource = list(
    Bucket = bucket,
    key = key
  )
)
#> Error: AccessDenied (HTTP 403). There were headers present in the request which were not signed

Created on 2024-08-16 with reprex v2.1.1

@DyfanJones
Copy link
Member Author

remotes::install_github("dyfanjones/paws/paws.common")
library(paws)
client <- s3(config(credentials(profile = "paws")))

bucket = "paws-rm"
key = "rm/%01file%/output.txt"

resp <- client$put_object(
  Bucket = bucket,
  Key = key,
  Body = charToRaw("helloworld")
)

client$copy_object(
  Bucket = bucket,
  Key = "file_out_1.txt",
  CopySource = sprintf("/%s/%s", bucket, key)
)
#> $CopyObjectResult
#> $CopyObjectResult$ETag
#> logical(0)
#> 
#> $CopyObjectResult$LastModified
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumCRC32
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumCRC32C
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumSHA1
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumSHA256
#> logical(0)
#> 
#> 
#> $Expiration
#> character(0)
#> 
#> $CopySourceVersionId
#> character(0)
#> 
#> $VersionId
#> character(0)
#> 
#> $ServerSideEncryption
#> [1] "AES256"
#> 
#> $SSECustomerAlgorithm
#> character(0)
#> 
#> $SSECustomerKeyMD5
#> character(0)
#> 
#> $SSEKMSKeyId
#> character(0)
#> 
#> $SSEKMSEncryptionContext
#> character(0)
#> 
#> $BucketKeyEnabled
#> logical(0)
#> 
#> $RequestCharged
#> character(0)

client$copy_object(
  Bucket = bucket,
  Key = "file_out_2.txt",
  CopySource = list(
    Bucket = bucket,
    Key = key
  )
)
#> $CopyObjectResult
#> $CopyObjectResult$ETag
#> logical(0)
#> 
#> $CopyObjectResult$LastModified
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumCRC32
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumCRC32C
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumSHA1
#> logical(0)
#> 
#> $CopyObjectResult$ChecksumSHA256
#> logical(0)
#> 
#> 
#> $Expiration
#> character(0)
#> 
#> $CopySourceVersionId
#> character(0)
#> 
#> $VersionId
#> character(0)
#> 
#> $ServerSideEncryption
#> [1] "AES256"
#> 
#> $SSECustomerAlgorithm
#> character(0)
#> 
#> $SSECustomerKeyMD5
#> character(0)
#> 
#> $SSEKMSKeyId
#> character(0)
#> 
#> $SSEKMSEncryptionContext
#> character(0)
#> 
#> $BucketKeyEnabled
#> logical(0)
#> 
#> $RequestCharged
#> character(0)

Created on 2024-08-16 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant