Skip to content

Commit

Permalink
Fixes support for special characters in keys 馃殤
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobvogel committed Jun 19, 2023
1 parent 88e783e commit ff4a276
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/ninja/S3Dispatcher.java
Expand Up @@ -766,6 +766,7 @@ private void copyObject(WebContext webContext, Bucket bucket, String key, String
}

// parse the path of the source object
sourcePath = Strings.urlDecode(sourcePath);
int sourceBucketNameStart = sourcePath.startsWith(PATH_DELIMITER) ? PATH_DELIMITER.length() : 0;
String sourceBucketName =
sourcePath.substring(sourceBucketNameStart, sourcePath.indexOf(PATH_DELIMITER, sourceBucketNameStart));
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/BaseAWSSpec.groovy
Expand Up @@ -421,7 +421,7 @@ abstract class BaseAWSSpec extends BaseSpecification {
def "Copying an object within the same bucket works as expected"() {
given:
def bucketName = DEFAULT_BUCKET_NAME
def keyFrom = "content"
def keyFrom = DEFAULT_KEY
def keyTo = keyFrom + "-copy"
def content = "I am pointless text content, but I deserve to exist twice and will thus be copied!"
def client = getClient()
Expand Down Expand Up @@ -451,7 +451,7 @@ abstract class BaseAWSSpec extends BaseSpecification {
given:
def bucketNameFrom = DEFAULT_BUCKET_NAME
def bucketNameTo = DEFAULT_BUCKET_NAME + "-copy"
def key = "content"
def key = DEFAULT_KEY
def content = "I am pointless text content, but I deserve to exist twice and will thus be copied!"
def client = getClient()
when:
Expand Down

0 comments on commit ff4a276

Please sign in to comment.