Code

Opened 3 years ago

Closed 2 years ago

#16753 closed Bug (fixed)

Handle protocol-relative URLs in syndication

Reported by: cato Owned by: nobody
Component: contrib.syndication Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When trying to use protocol-relative URLs (see 1 or 2) like for example returned by django-hosts the syndication framework prepends the protocol and the domain. This way a valid URL is transformed into an invalid or at least useless URL.

Example:

class MyFeed(Feed):
    def item_link(self, item):
       url = reverse_crossdomain("myhost", "myview", 
                            view_kwargs={'some': 'argument'})
       return url

The value of url is "example.com/path/to/view/" and the rendered feed contains http://example.com//example.com/path/to/view/.

The syndication framework should either just pass the url as it is or prepend the protocol. For the case of prepending the protocol a patch is attached

Attachments (1)

patch.diff (1.2 KB) - added by cato 3 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

This bug is described in the comments of #16727.

Changed 3 years ago by cato

comment:2 Changed 2 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

In [17108]:

(The changeset message doesn't reference this ticket)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.