Procházet zdrojové kódy

Bug fix: Too long automatic bug reports were rejected

Conflicts:
	source/resource/TextsWin1.rc
	source/windows/Setup.cpp

(https changed to http)

Source commit: 5888709a3702c11aa177a9abb58474bc64e9a07e
Martin Prikryl před 9 roky
rodič
revize
ff84de561c

+ 5 - 3
source/forms/MessageDlg.cpp

@@ -149,10 +149,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

@@ -506,8 +506,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

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

+ 2 - 0
source/windows/Setup.cpp

@@ -744,6 +744,8 @@ UnicodeString __fastcall CampaignUrl(UnicodeString URL)
 {
   int CurrentCompoundVer = Configuration->CompoundVersion;
   AnsiString 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()