• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修訂b8ff1dce5a5df630e773db1f7c89251bdbe389ab (tree)
時間2012-05-10 04:12:59
作者Rick Copeland <rick@arbo...>
CommiterRick Copeland

Log Message

[#3960] Remove /nf/redirect conversions

Signed-off-by: Rick Copeland <rick@arborian.com>

Change Summary

差異

--- a/Allura/allura/controllers/static.py
+++ b/Allura/allura/controllers/static.py
@@ -20,25 +20,3 @@ class NewForgeController(object):
2020 h.set_context(project, app, neighborhood=neighborhood)
2121 html = g.markdown_wiki.convert(markdown)
2222 return html
23-
24- @expose()
25- @with_trailing_slash
26- def redirect(self, path, **kw):
27- """Redirect to external sites."""
28-
29- # Make sure the url can be encoded to iso-8859-1 (required for HTTP
30- # headers. If it can't, urlquote it first, then redirect. Allows us to
31- # redirect to external links in markdown, even if the url contains
32- # unquoted unicode chars.
33- try:
34- path.encode('ISO-8859-1')
35- except UnicodeEncodeError:
36- i = path.find('://')
37- if i > -1:
38- scheme = path[:i+3]
39- path = path[i+3:]
40- else:
41- scheme = ''
42- path = scheme + h.urlquote(path)
43- redirect(path)
44-
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -228,7 +228,6 @@ class RelativeLinkRewriter(markdown.postprocessors.Postprocessor):
228228 if 'sf.net' in val or 'sourceforge.net' in val:
229229 return
230230 else:
231- tag[attr] = '/nf/redirect/?path=%s' % h.urlquote(val)
232231 tag['rel']='nofollow'
233232 return
234233 if val.startswith('/'): return
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -92,15 +92,6 @@ class TestRootController(TestController):
9292 r = self.app.get('/nf/markdown_to_html?markdown=*aaa*bb[wiki:Home]&project=test&app=bugs&neighborhood=%s' % n._id, validate_chunk=True)
9393 assert '<p><em>aaa</em>bb<a href="/p/test/wiki/Home/">[wiki:Home]</a></p>' in r, r
9494
95- def test_redirect_external(self):
96- r = self.app.get('/nf/redirect/?path=%s' % quote('http://en.wikipedia.org/wiki/Aho–Corasick_string_matching_algorithm'))
97- assert r.status_int == 302
98- assert r.location == 'http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm'
99-
100- r = self.app.get('/nf/redirect/?path=%s' % quote('http://google.com'))
101- assert r.status_int == 302
102- assert r.location == 'http://google.com'
103-
10495 def test_slash_redirect(self):
10596 r = self.app.get('/p',status=301)
10697 r = self.app.get('/p/',status=200)
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -123,9 +123,9 @@ def test_markdown():
123123 assert '<a href=' not in g.markdown.convert('# Foo!\n[Rooted]')
124124 assert '<a href=' in g.markdown.convert('This is http://sf.net')
125125 tgt = 'http://everything2.com/?node=nate+oostendorp'
126- url = '/nf/redirect/?path=%s' % quote(tgt)
127126 s = g.markdown.convert('This is %s' % tgt)
128- assert s == '<div class="markdown_content"><p>This is <a href="%s" rel="nofollow">%s</a></p></div>' % (url, tgt), s
127+ assert_equal(
128+ s, '<div class="markdown_content"><p>This is <a href="%s" rel="nofollow">%s</a></p></div>' % (tgt, tgt))
129129 assert '<a href=' in g.markdown.convert('This is http://sf.net')
130130 # assert '<a href=' in g.markdown_wiki.convert('This is a WikiPage')
131131 # assert '<a href=' not in g.markdown_wiki.convert('This is a WIKIPAGE')