mirror of https://github.com/apache/jclouds.git
JCLOUDS-1533 - Fix upload with SAS token when blob name contains slash (#61)
This commit is contained in:
parent
3db2939885
commit
ca5190636a
|
@ -23,6 +23,7 @@ import static org.jclouds.util.Patterns.NEWLINE_PATTERN;
|
|||
import static org.jclouds.util.Strings2.toInputStream;
|
||||
import org.jclouds.http.Uris.UriBuilder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -120,8 +121,10 @@ public class SharedKeyLiteAuthentication implements HttpRequestFilter {
|
|||
String[] parametersArray = cutUri(requestUri);
|
||||
String containerName = parametersArray[1];
|
||||
UriBuilder endpoint = Uris.uriBuilder(storageUrl).appendPath(containerName);
|
||||
if (parametersArray.length == 3) {
|
||||
endpoint.appendPath(parametersArray[2]).query(finalQuery);
|
||||
if (parametersArray.length >= 3) {
|
||||
String[] blobNameParts = Arrays.copyOfRange(parametersArray, 2, parametersArray.length);
|
||||
String blobName = Joiner.on("/").join(blobNameParts);
|
||||
endpoint.appendPath(blobName).query(finalQuery);
|
||||
} else {
|
||||
endpoint.query("restype=container&" + finalQuery);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ public class SharedKeyLiteAuthenticationTest {
|
|||
+ ".blob.core.windows.net/movies/MOV1.avi?comp=block&blockid=BlockId1&timeout=60").build(), filterSAS, "https://foo.blob.core.windows.net/movies/MOV1.avi?comp=block&blockid=BlockId1&timeout=60&sv=2018-03-28&ss=b&srt=sco&sp=rwdlac&se=2019-02-13T17%3A18%3A22Z&st=2019-02-13T09%3A18%3A22Z&spr=https&sig=sMnaKSD94CzEPeGnWauTT0wBNIn%2B4ySkZO5PEAW7zs%3D"},
|
||||
{ HttpRequest.builder().method(HttpMethod.PUT).endpoint("https://" + ACCOUNT
|
||||
+ ".blob.core.windows.net/movies/MOV1.avi?comp=blocklist&timeout=120").build(), filterSAS, "https://foo.blob.core.windows.net/movies/MOV1.avi?comp=blocklist&timeout=120&sv=2018-03-28&ss=b&srt=sco&sp=rwdlac&se=2019-02-13T17%3A18%3A22Z&st=2019-02-13T09%3A18%3A22Z&spr=https&sig=sMnaKSD94CzEPeGnWauTT0wBNIn%2B4ySkZO5PEAW7zs%3D" },
|
||||
{ HttpRequest.builder().method(HttpMethod.PUT).endpoint("https://" + ACCOUNT
|
||||
+ ".blob.core.windows.net/movies/comedy/MOV1.avi?comp=block&blockid=BlockId1&timeout=60").build(), filterSAS, "https://foo.blob.core.windows.net/movies/comedy/MOV1.avi?comp=block&blockid=BlockId1&timeout=60&sv=2018-03-28&ss=b&srt=sco&sp=rwdlac&se=2019-02-13T17%3A18%3A22Z&st=2019-02-13T09%3A18%3A22Z&spr=https&sig=sMnaKSD94CzEPeGnWauTT0wBNIn%2B4ySkZO5PEAW7zs%3D"},
|
||||
{ HttpRequest.builder().method(HttpMethod.GET).endpoint("https://" + ACCOUNT
|
||||
+ ".blob.core.windows.net/movies/MOV1.avi").build(), filterSAS, "https://foo.blob.core.windows.net/movies/MOV1.avi?sv=2018-03-28&ss=b&srt=sco&sp=rwdlac&se=2019-02-13T17%3A18%3A22Z&st=2019-02-13T09%3A18%3A22Z&spr=https&sig=sMnaKSD94CzEPeGnWauTT0wBNIn%2B4ySkZO5PEAW7zs%3D" },
|
||||
{ HttpRequest.builder().method(HttpMethod.GET).endpoint("https://" + ACCOUNT
|
||||
|
|
Loading…
Reference in New Issue