tickets: 8758
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8758 | 2008-09-01 12:09:24 | 2010-01-28 13:59:58 | 2022-03-06 03:43:05.780167 | Accepted | closed | contrib.syndication | 1.0 | fixed | get_tag_uri in /django/utils/feedgenerator.py breaks with port numbers | The following function: {{{ def get_tag_uri(url, date): "Creates a TagURI. See http://diveintomark.org/archives/2004/05/28/howto-atom-id" tag = re.sub('^http://', '', url) if date is not None: tag = re.sub('/', ',%s:/' % date.strftime('%Y-%m-%d'), tag, 1) tag = re.sub('#', '/', tag) return u'tag:' + tag }} - http://code.djangoproject.com/browser/django/trunk/django/utils/feedgenerator.py#L48 ... breaks for domain names with a port number, such as http://example.org:8080/ as this produces the following TAG value: {{{ tag:example.org:8080,2007-09-21:/ }}} From http://feedvalidator.org/docs/error/InvalidTAG.html and http://tools.ietf.org/html/rfc4151#section-2.1 you can see that the TAG URI should not contain the port number. The following patch should be able to extract the domain name from the link: {{{ - tag = re.sub('^http://', '', url) + tag = str(urllib.splitport(urllib.splithost(urllib.splittype(url)[1])[0])[0]) }}} | arthurk | nslater | 0 | 1 | 0 | 0 | 0 | 0 |