Skip to content

Commit

Permalink
Hopeful fix for the many reported issues relating to infinite redirec…
Browse files Browse the repository at this point in the history
…ts. Many thanks to Jeffery Read <jread@vendasta.com> for the patch.
  • Loading branch information
sciyoshi committed Nov 24, 2008
1 parent 36ec94b commit 2a6b442
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions facebook/djangofb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

import facebook

from django.http import HttpResponse, HttpResponseRedirect
Expand All @@ -22,6 +24,8 @@ def redirect(self, url):
"""
if self.in_canvas:
return HttpResponse('<fb:redirect url="%s" />' % (url, ))
elif re.search("^https?:\/\/([^\/]*\.)?facebook\.com(:\d+)?", url.lower()):
return HttpResponse('<script type="text/javascript">\ntop.location.href = "%s";\n</script>' % url)
else:
return HttpResponseRedirect(url)

Expand Down

0 comments on commit 2a6b442

Please sign in to comment.