This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH 5/5] Canonicalize manually added mirror URLs to ensure they end with a '/'
- From: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- To: cygwin-apps at cygwin dot com
- Cc: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- Date: Tue, 9 Nov 2010 13:29:47 +0000
- Subject: [PATCH 5/5] Canonicalize manually added mirror URLs to ensure they end with a '/'
- References: <1289309387-5232-1-git-send-email-jon.turney@dronecode.org.uk>
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