• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28837 (tree)
Zeit2020-03-31 01:28:43
Autorcsware

Log Message

Use common method for replacing %BUGID% placeholder in URL.

Based on TortoiseGit commit 4e318c29638a6d871d105c348d2d4f05bf8d1b99.

Ändern Zusammenfassung

Diff

--- trunk/src/TortoiseProc/ProjectProperties.cpp (revision 28836)
+++ trunk/src/TortoiseProc/ProjectProperties.cpp (revision 28837)
@@ -543,19 +543,21 @@
543543 if (sUrl.IsEmpty())
544544 return ret;
545545 if (!sMessage.IsEmpty() || !sCheckRe.IsEmpty())
546- {
547- ret = sUrl;
548- CString parameter;
549- DWORD size = INTERNET_MAX_URL_LENGTH;
550- UrlEscape(sBugID, CStrBuf(parameter, size + 1), &size, URL_ESCAPE_SEGMENT_ONLY | URL_ESCAPE_PERCENT | URL_ESCAPE_AS_UTF8);
551- // UrlEscape does not escape + and =, starting with Win8 the URL_ESCAPE_ASCII_URI_COMPONENT flag could be used and the following two lines would not be necessary
552- parameter.Replace(L"+", L"%2B");
553- parameter.Replace(L"=", L"%3D");
554- ret.Replace(L"%BUGID%", parameter);
555- }
546+ ReplaceBugIDPlaceholder(ret, sBugID);
556547 return ret;
557548 }
558549
550+void ProjectProperties::ReplaceBugIDPlaceholder(CString& url, const CString& sBugID)
551+{
552+ CString parameter;
553+ DWORD size = INTERNET_MAX_URL_LENGTH;
554+ UrlEscape(sBugID, CStrBuf(parameter, size + 1), &size, URL_ESCAPE_SEGMENT_ONLY | URL_ESCAPE_PERCENT | URL_ESCAPE_AS_UTF8);
555+ // UrlEscape does not escape + and =, starting with Win8 the URL_ESCAPE_ASCII_URI_COMPONENT flag could be used and the following two lines would not be necessary
556+ parameter.Replace(L"+", L"%2B");
557+ parameter.Replace(L"=", L"%3D");
558+ url.Replace(L"%BUGID%", parameter);
559+}
560+
559561 BOOL ProjectProperties::CheckBugID(const CString& sID)
560562 {
561563 if (bNumber)
--- trunk/src/TortoiseProc/ProjectProperties.h (revision 28836)
+++ trunk/src/TortoiseProc/ProjectProperties.h (revision 28837)
@@ -155,6 +155,11 @@
155155 */
156156 CString GetBugIDUrl(const CString& sBugID);
157157
158+ /**
159+ * Replaces %BUGID% in the provided URL with the sBugID after doing URL encoding
160+ */
161+ static void ReplaceBugIDPlaceholder(CString& url, const CString& sBugID);
162+
158163 /**
159164 * Inserts the tsvn:autoprops into the Subversion config section.
160165 * Call this before an import or an add operation.
--- trunk/src/Utils/MiscUI/SciEdit.cpp (revision 28836)
+++ trunk/src/Utils/MiscUI/SciEdit.cpp (revision 28837)
@@ -997,7 +997,7 @@
997997 else
998998 {
999999 url = m_sUrl;
1000- url.Replace(L"%BUGID%", StringFromControl(textbuffer.get()));
1000+ ProjectProperties::ReplaceBugIDPlaceholder(url, StringFromControl(textbuffer.get()));
10011001
10021002 // is the URL a relative one?
10031003 if (url.Left(2).Compare(L"^/") == 0)
Show on old repository browser