On 29/11/2010 10:38, Corinna Vinschen wrote:
> On Nov 26 13:48, Jon TURNEY wrote:
>> This prevents a mirror URL being added twice (with and without a terminal 
>> '/')
>>
>> This ensures that the download directory is consistently named, avoiding
>> downloading everything again, even if an additional mirror URL is added
>> in a form which differs in the presence of a terminal '/' from last time.
>>
>> 2010-11-26  Jon TURNEY <jon.turney-grjqepx9rppajuda+fb...@public.gmane.org>
>>
>>      * site.cc (init): Canonicalize mirror URLs to ensure the end
>>      with a '/'.
>>
>> Signed-off-by: Jon TURNEY 
>> <jon.turney-grjqepx9rppajuda+fb...@public.gmane.org>
>> ---
>>  site.cc |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/site.cc b/site.cc
>> index 42839f3..ff617b5 100644
>> --- a/site.cc
>> +++ b/site.cc
>> @@ -141,6 +141,10 @@ site_list_type::init (const string &_url, const string 
>> &_servername,
>>    area = _area;
>>    location = _location;
>>  
>> +  /* Canonicalize URL to ensure it ends with a '/' */
>> +  if (url.at(url.length()-1) != '/')
>> +    url.append("/");
>> +
>>    /* displayed_url is protocol and site name part of url */
>>    string::size_type path_offset = url.find ("/", url.find ("//") + 2);
>>    displayed_url = url.substr(0, path_offset);
>> -- 
> 
> Looks good, please apply.

Okay, done.

Reply via email to