gianm commented on a change in pull request #8903: S3 input source
URL: https://github.com/apache/incubator-druid/pull/8903#discussion_r349862749
 
 

 ##########
 File path: 
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3DataSegmentPuller.java
 ##########
 @@ -84,7 +81,7 @@ public S3DataSegmentPuller(ServerSideEncryptingAmazonS3 
s3Client)
     try {
       org.apache.commons.io.FileUtils.forceMkdir(outDir);
 
-      final URI uri = URI.create(StringUtils.format("s3://%s/%s", 
s3Coords.bucket, s3Coords.path));
+      final URI uri = URI.create(StringUtils.format("s3://%s/%s", 
s3Coords.getBucket(), s3Coords.getPath()));
 
 Review comment:
   This code is definitely buggy, please at least include a comment warning 
future devs as much. (You aren't doing much here besides mechanical 
refactoring, so I wouldn't insist on fixing it or adding tests, but the comment 
is nice.)
   
   Example of the bug:
   
   ```java
   scala> URI.create(String.format("s3://%s/%s", "mybucket", 
"path/to/myobject?question")).getPath
   res1: String = /path/to/myobject
   ```
   
   Also:
   
   ```java
   scala> URI.create(String.format("s3://%s/%s", "mybucket", 
"path/to/100%myobject")).getPath
   java.lang.IllegalArgumentException: Malformed escape pair at index 25: 
s3://mybucket/path/to/100%myobject
     at java.net.URI.create(URI.java:852)
     ... 28 elided
   Caused by: java.net.URISyntaxException: Malformed escape pair at index 25: 
s3://mybucket/path/to/100%myobject
     at java.net.URI$Parser.fail(URI.java:2848)
     at java.net.URI$Parser.scanEscape(URI.java:2978)
     at java.net.URI$Parser.scan(URI.java:3001)
     at java.net.URI$Parser.checkChars(URI.java:3019)
     at java.net.URI$Parser.parseHierarchical(URI.java:3105)
     at java.net.URI$Parser.parse(URI.java:3053)
     at java.net.URI.<init>(URI.java:588)
     at java.net.URI.create(URI.java:850)
     ... 28 more
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to