Bläddra i källkod

AWS profile check was incorrect + Making the check case-insensitive for consistency with AWS config reading

Source commit: 2a92b357e5ced2f067b3af4d2ec370a0e9ee7392
Martin Prikryl 2 år sedan
förälder
incheckning
9fb5716081
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4 2
      source/core/S3FileSystem.cpp

+ 4 - 2
source/core/S3FileSystem.cpp

@@ -91,7 +91,9 @@ UnicodeString GetS3Profile()
 TStrings * GetS3Profiles()
 {
   NeedS3Config();
-  std::unique_ptr<TStrings> Result(new TStringList());
+  // S3 allegedly treats the section case-sensitivelly, but our GetS3ConfigValue (ReadString) does not,
+  // so consistently we return case-insensitive list.
+  std::unique_ptr<TStrings> Result(CreateSortedStringList());
   if (S3ConfigFile.get() != NULL)
   {
     S3ConfigFile->ReadSections(Result.get());
@@ -222,7 +224,7 @@ void __fastcall TS3FileSystem::Open()
   if (!S3Profile.IsEmpty() && !FTerminal->SessionData->FingerprintScan)
   {
     std::unique_ptr<TStrings> S3Profiles(GetS3Profiles());
-    if (S3Profiles->IndexOf(S3Profile))
+    if (S3Profiles->IndexOf(S3Profile) < 0)
     {
       throw Exception(MainInstructions(FMTLOAD(S3_PROFILE_NOT_EXIST, (S3Profile))));
     }