Django

Code

Ticket #7494 (closed: fixed)

Opened 6 months ago

Last modified 3 months ago

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

Reported by: tom@almostobsolete.net Assigned to: RobotAdam
Milestone: 1.0 Component: HTTP handling
Version: SVN Keywords: aug22sprint
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

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

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

According to http://www.faqs.org/rfcs/rfc1738.html it is perfectly valid to have a ":" in the path part of a HTTP url.

Attachments

fix_absolute_url_check_in_get_absolute_url.diff (0.9 kB) - added by tom@almostobsolete.net on 06/18/08 07:01:13.
Patch that fixes the problem
fix_absolute_url_check_with_tests.diff (1.5 kB) - added by RobotAdam on 08/22/08 12:43:12.
Updated patch including tests

Change History

06/18/08 07:01:13 changed by tom@almostobsolete.net

  • attachment fix_absolute_url_check_in_get_absolute_url.diff added.

Patch that fixes the problem

06/18/08 07:06:17 changed by anonymous

  • needs_better_patch changed.
  • component changed from Uncategorized to HTTP handling.
  • needs_tests changed.
  • needs_docs changed.

08/08/08 09:42:23 changed by ericholscher

  • owner changed from nobody to ericholscher.
  • needs_better_patch set to 1.
  • status changed from new to assigned.
  • needs_tests set to 1.
  • milestone set to 1.0.

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

08/08/08 11:45:58 changed by ericholscher

  • stage changed from Unreviewed to Accepted.

08/08/08 12:16:50 changed by ericholscher

  • owner deleted.
  • status changed from assigned to new.

08/22/08 12:43:12 changed by RobotAdam

  • attachment fix_absolute_url_check_with_tests.diff added.

Updated patch including tests

08/22/08 12:45:29 changed by RobotAdam

  • keywords set to aug22sprint.
  • owner set to RobotAdam.
  • status changed from new to assigned.

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

08/22/08 15:31:00 changed by RobotAdam

  • needs_tests deleted.

08/23/08 12:28:13 changed by mtredinnick

  • status changed from assigned to closed.
  • resolution set to fixed.

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


Add/Change #7494 (build_absolute_url method of the HttpRequest class fails with urls with : in their path)




Change Properties
Action