handle edge case when bucket name and first part of endpoint match

This commit is contained in:
Bryce Larson 2019-10-26 00:38:11 -06:00
parent 0e815c2fbc
commit 0c42a74a8a
No known key found for this signature in database
GPG Key ID: 131C38B0F02DB4CA

View File

@ -4689,7 +4689,7 @@ string prepare_url(const char* url)
string path; string path;
string url_str = string(url); string url_str = string(url);
string token = string("/") + bucket; string token = string("/") + bucket;
int bucket_pos = url_str.find(token); int bucket_pos;
int bucket_length = token.size(); int bucket_length = token.size();
int uri_length = 0; int uri_length = 0;
@ -4699,6 +4699,7 @@ string prepare_url(const char* url)
uri_length = 7; uri_length = 7;
} }
uri = url_str.substr(0, uri_length); uri = url_str.substr(0, uri_length);
bucket_pos = url_str.find(token, uri_length);
if(!pathrequeststyle){ if(!pathrequeststyle){
hostname = bucket + "." + url_str.substr(uri_length, bucket_pos - uri_length); hostname = bucket + "." + url_str.substr(uri_length, bucket_pos - uri_length);