Pārlūkot izejas kodu

Bug 1781: Lower-than (<) and greater-than (>) symbols are not escaped in an output of RemotePath.EscapeFileMask .NET method and in a script generated by the GUI

Source commit: d9d53dac196f92d1b6c681f4bc3477b0ab47145d
Martin Prikryl 6 gadi atpakaļ
vecāks
revīzija
54aec18b11
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 1 1
      dotnet/RemotePath.cs
  2. 3 1
      source/forms/GenerateUrl.cpp

+ 1 - 1
dotnet/RemotePath.cs

@@ -20,7 +20,7 @@ namespace WinSCP
             string path = lastSlash > 0 ? fileMask.Substring(0, lastSlash + 1) : string.Empty;
             string mask = lastSlash > 0 ? fileMask.Substring(lastSlash + 1) : fileMask;
             // Keep in sync with EscapeFileMask in GenerateUrl.cpp
-            mask = mask.Replace("[", "[[]").Replace("*", "[*]").Replace("?", "[?]");
+            mask = mask.Replace("[", "[[]").Replace("*", "[*]").Replace("?", "[?]").Replace("<", "<<").Replace(">", ">>");
             return path + mask;
         }
 

+ 3 - 1
source/forms/GenerateUrl.cpp

@@ -247,7 +247,9 @@ static UnicodeString __fastcall QuoteStringParam(UnicodeString S)
 // Keep in sync with .NET Session.EscapeFileMask
 static UnicodeString __fastcall EscapeFileMask(UnicodeString S)
 {
-  return ReplaceStr(ReplaceStr(ReplaceStr(S, L"[", L"[[]"), L"*", L"[*]"), L"?", L"[?]");
+  return
+    ReplaceStr(ReplaceStr(ReplaceStr(ReplaceStr(ReplaceStr(
+      S, L"[", L"[[]"), L"*", L"[*]"), L"?", L"[?]"), L">", L">>"), L"<", L"<<");
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TGenerateUrlDialog::GenerateUrl()