Fix bug, when bucketname contains .

This commit is contained in:
jan
2015-01-23 14:51:54 +01:00
parent 81c2d884d8
commit 805038592d
@@ -70,7 +70,8 @@ public class AmazonS3FileStorageServiceImpl implements FileStorageService {
private static URI getUri(String key) {
try {
return new URI(retrievalProtocol, bucketName + "." + baseUrl, "/" + key, null);
// FIXME: region is missing s3-... see: http://stackoverflow.com/questions/10975475/amazon-s3-upload-file-and-get-url
return new URI(retrievalProtocol, baseUrl + "/" + bucketName, "/" + key, null);
} catch (URISyntaxException e) {
logger.log(Level.WARNING, "Could not create URI for uploaded file with key " + key, e);
return null;
@@ -97,5 +98,4 @@ public class AmazonS3FileStorageServiceImpl implements FileStorageService {
s3.deleteObject(new DeleteObjectRequest(bucketName, key));
logger.info("Removed file " + uri);
}
}