浏览代码

Bug fix: Too long automatic bug reports were rejected

Source commit: 4c8d01d3d93424803453cd44f0ebb8ec0fd3735a
Martin Prikryl 10 年之前
父节点
当前提交
b46c67a818
共有 5 个文件被更改,包括 16 次插入10 次删除
  1. 5 3
      source/forms/MessageDlg.cpp
  2. 2 2
      source/resource/TextsWin.h
  3. 2 2
      source/resource/TextsWin1.rc
  4. 2 0
      source/windows/Setup.cpp
  5. 5 3
      source/windows/WinHelp.cpp

+ 5 - 3
source/forms/MessageDlg.cpp

@@ -151,10 +151,12 @@ void __fastcall TMessageForm::HelpButtonClick(TObject * /*Sender*/)
 //---------------------------------------------------------------------------
 void __fastcall TMessageForm::ReportButtonClick(TObject * /*Sender*/)
 {
+  // Report text goes last, as it may exceed URL parameters limit (2048) and get truncated.
+  // And we need to preserve the other parameters.
   UnicodeString Url =
-    FMTLOAD(ERROR_REPORT_URL,
-      (EncodeUrlString(GetReportText()), Configuration->ProductVersion,
-       IntToHex(__int64(GUIConfiguration->Locale), 4)));
+    FMTLOAD(ERROR_REPORT_URL2,
+      (Configuration->ProductVersion, IntToHex(__int64(GUIConfiguration->Locale), 4),
+       EncodeUrlString(GetReportText())));
 
   OpenBrowser(Url);
 }

+ 2 - 2
source/resource/TextsWin.h

@@ -576,8 +576,8 @@
 #define DOCUMENTATION_URL2      4009
 #define DOCUMENTATION_KEYWORD_URL2 4010
 #define LOCALES_URL             4011
-#define DOCUMENTATION_SEARCH_URL2 4012
-#define ERROR_REPORT_URL        4013
+#define DOCUMENTATION_SEARCH_URL3 4012
+#define ERROR_REPORT_URL2       4013
 #define UPGRADE_URL             4014
 
 #endif // TextsWin

+ 2 - 2
source/resource/TextsWin1.rc

@@ -571,8 +571,8 @@ BEGIN
         DOCUMENTATION_URL2, "https://winscp.net/eng/docs/?ver=%s&lang=%s"
         DOCUMENTATION_KEYWORD_URL2, "https://winscp.net/eng/docs/%s?ver=%s&lang=%s"
         LOCALES_URL, "https://winscp.net/eng/translations.php"
-        DOCUMENTATION_SEARCH_URL2, "https://winscp.net/eng/docs/search.php?q=%s&ver=%s&lang=%s"
-        ERROR_REPORT_URL, "https://winscp.net/forum/posting.php?mode=newtopic&report=%s&ver=%s&lang=%s"
+        DOCUMENTATION_SEARCH_URL3, "https://winscp.net/eng/docs/search.php?ver=%s&lang=%s&q=%s"
+        ERROR_REPORT_URL2, "https://winscp.net/forum/posting.php?mode=newtopic&ver=%s&lang=%s&report=%s"
         UPGRADE_URL, "https://winscp.net/eng/upgrade.php"
 
 END

+ 2 - 0
source/windows/Setup.cpp

@@ -764,6 +764,8 @@ UnicodeString __fastcall CampaignUrl(UnicodeString URL)
 {
   int CurrentCompoundVer = Configuration->CompoundVersion;
   UnicodeString Version = VersionStrFromCompoundVersion(CurrentCompoundVer);
+  // Beware that these parameters may get truncated if URL is too long,
+  // such as with ERROR_REPORT_URL2
   UnicodeString Params = FORMAT(L"utm_source=winscp&utm_medium=app&utm_campaign=%s", (Version));
 
   return AppendUrlParams(URL, Params);

+ 5 - 3
source/windows/WinHelp.cpp

@@ -33,9 +33,11 @@ private:
 //---------------------------------------------------------------------------
 void __fastcall SearchHelp(const UnicodeString & Message)
 {
-  OpenBrowser(FMTLOAD(DOCUMENTATION_SEARCH_URL2,
-    (EncodeUrlString(Message), Configuration->ProductVersion,
-     IntToHex(__int64(GUIConfiguration->Locale), 4))));
+  // Message goes last, as it may exceed URL parameters limit (2048) and get truncated.
+  // And we need to preserve the other parameters.
+  OpenBrowser(FMTLOAD(DOCUMENTATION_SEARCH_URL3,
+    (Configuration->ProductVersion, IntToHex(__int64(GUIConfiguration->Locale), 4),
+     EncodeUrlString(Message))));
 }
 //---------------------------------------------------------------------------
 void __fastcall InitializeWinHelp()