1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-28 15:35:08 +03:00

Bug fix: Hidden session settings S3DefaultRegion to create an S3 bucket in a non-default region was not working

Source commit: 0223792971b656534792aef7fa07a1edd1c8d4d9
This commit is contained in:
Martin Prikryl
2018-01-10 15:59:37 +00:00
parent 504f2c04d0
commit 89a92bc649
3 changed files with 16 additions and 4 deletions

View File

@@ -1024,11 +1024,19 @@ void __fastcall TS3FileSystem::CreateDirectory(const UnicodeString ADirName)
{
S3ResponseHandler ResponseHandler = CreateResponseHandler();
// Not using GetBucketContext here, as the bucket does not exist, so we have to explicitly use S3DefaultRegion
// Not using GetBucketContext here, as the bucket does not exist
UTF8String RegionBuf;
char * Region = NULL;
if (FTerminal->SessionData->S3DefaultRegion != S3LibDefaultRegion())
{
RegionBuf = UTF8String(FTerminal->SessionData->S3DefaultRegion);
Region = RegionBuf.c_str();
}
S3_create_bucket(
FLibS3Protocol, FAccessKeyId.c_str(), FSecretAccessKey.c_str(), NULL, FHostName.c_str(), StrToS3(BucketName),
StrToS3(FTerminal->SessionData->S3DefaultRegion), S3CannedAclPrivate, NULL, FRequestContext, FTimeout,
&ResponseHandler, &Data);
StrToS3(S3LibDefaultRegion()), S3CannedAclPrivate, Region, FRequestContext, FTimeout, &ResponseHandler, &Data);
}
else
{