From: Jeremy Stanley Date: Sun, 31 May 2020 14:39:34 +0000 (+0000) Subject: Caching support for URLs with port numbers X-Git-Tag: 2.4~4 X-Git-Url: https://www.yuggoth.org/gitweb?p=weather.git;a=commitdiff_plain;h=28a5c0e1e6973b30d7dfa2659495c4533281ec56 Caching support for URLs with port numbers When mangling URLs of fetched data to store in the local cache, only split on the first colon so that URLs with port numbers in them are properly differentiated. Previously, all URLs for the same domain name landed in a single file if a port number was included, causing incorrect results to be returned from the cache. --- diff --git a/weather.py b/weather.py index 1dfa081..71cf0ec 100644 --- a/weather.py +++ b/weather.py @@ -212,7 +212,7 @@ def get_uri( except (IOError, OSError): pass dcache_fn = os.path.join( dcachedir, - uri.split(":")[1].replace("/","_") + uri.split(":",1)[1].replace("/","_") ) now = time.time() if cache_data and os.access(dcache_fn, os.R_OK) \