Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#7494 closed (fixed)

build_absolute_url method of the HttpRequest class fails with urls with : in their path

Reported by: tom@… Owned by: RobotAdam
Component: HTTP handling Version: master
Severity: Keywords: aug22sprint
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


When build_absolute_url is called for a location that should contain a ":" character in it's path it fails to add the "" part.

This is because off line 76 of django/http/ where "if not ':' in location:" is used to check if the location is already absolute.

According to it is perfectly valid to have a ":" in the path part of a HTTP url.

Attachments (2)

fix_absolute_url_check_in_get_absolute_url.diff (890 bytes) - added by tom@… 10 years ago.
Patch that fixes the problem
fix_absolute_url_check_with_tests.diff (1.5 KB) - added by RobotAdam 10 years ago.
Updated patch including tests

Download all attachments as: .zip

Change History (10)

Changed 10 years ago by tom@…

Patch that fixes the problem

comment:1 Changed 10 years ago by anonymous

Component: UncategorizedHTTP handling

comment:2 Changed 10 years ago by Eric Holscher

milestone: 1.0
Needs tests: set
Owner: changed from nobody to Eric Holscher
Patch needs improvement: set
Status: newassigned

The https:// shouldn't be hard coded in. This looks like it is a bug though.

comment:3 Changed 10 years ago by Eric Holscher

Triage Stage: UnreviewedAccepted

comment:4 Changed 10 years ago by Eric Holscher

Owner: Eric Holscher deleted
Status: assignednew

Changed 10 years ago by RobotAdam

Updated patch including tests

comment:5 Changed 10 years ago by RobotAdam

Keywords: aug22sprint added
Owner: set to RobotAdam
Status: newassigned

The "https?" in the regexp is correct with the question mark. I've updated the patch with tests that confirm it.

comment:6 Changed 10 years ago by RobotAdam

Needs tests: unset

comment:7 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: assignedclosed

(In [8490]) Fixed #7494 -- Fixed build_absolute_url() for some types of (uncommon) URLs.
Patch from tom@… and RobotAdam.

comment:8 Changed 7 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top