This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 5/5] Canonicalize manually added mirror URLs to ensure they end with a '/'


This ensures that the download directory is canonically named with the
trailing %2f of the url-encoded '/', avoiding downloading everything again
if the URL varies in the presence of a '/' at the end from last time.

This also prevents a mirror URL being added twice in these two different
forms.

2010-11-07  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* site.cc (OnMessageCmd): Canonicalize manually added mirror URLS to
	ensure they end with '/'
---
 site.cc |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/site.cc b/site.cc
index a7b378e..1a65ec9 100644
--- a/site.cc
+++ b/site.cc
@@ -688,6 +688,11 @@ bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code)
 	  {
 	    // User pushed the Add button.
 	    std::string other_url = egetString (GetHWND (), IDC_EDIT_USER_URL);
+
+            // Ensure it ends with a '/'
+            if (other_url.at(other_url.length()-1) != '/')
+              other_url.append("/");
+
 	    if (other_url.size())
 	    {
 	    site_list_type newsite (other_url, "", "", "");
-- 
1.7.2.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]