Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #4685 -- 'View on site' now works for https URLs. Thanks, cbran…

…d@redback.com, treborhudson@gmail.com, Jeff Hilyard

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c7b49792f4de416c903965ff5d029a566b8d7ef8 1 parent ee7fe94
Adrian Holovaty authored July 03, 2007

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  django/views/defaults.py
5  django/views/defaults.py
@@ -21,7 +21,7 @@ def shortcut(request, content_type_id, object_id):
21 21
     # if necessary.
22 22
 
23 23
     # If the object actually defines a domain, we're done.
24  
-    if absurl.startswith('http://'):
  24
+    if absurl.startswith('http://') or absurl.startswith('https://'):
25 25
         return http.HttpResponseRedirect(absurl)
26 26
 
27 27
     object_domain = None
@@ -61,7 +61,8 @@ def shortcut(request, content_type_id, object_id):
61 61
     # If all that malarkey found an object domain, use it; otherwise fall back
62 62
     # to whatever get_absolute_url() returned.
63 63
     if object_domain is not None:
64  
-        return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
  64
+        protocol = request.is_secure() and 'https' or 'http'
  65
+        return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl))
65 66
     else:
66 67
         return http.HttpResponseRedirect(absurl)
67 68
 

0 notes on commit c7b4979

Please sign in to comment.
Something went wrong with that request. Please try again.