1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

Quote url path

This commit is contained in:
zhengxie
2013-04-03 11:49:32 +08:00
parent 39aa65bfef
commit 05e0d314fd
2 changed files with 6 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ from django.http import HttpResponse, HttpResponseRedirect, Http404, \
from django.shortcuts import render_to_response, redirect
from django.template import Context, loader, RequestContext
from django.template.loader import render_to_string
from django.utils.encoding import smart_str
from django.utils.hashcompat import md5_constructor
from django.utils.http import urlquote
from django.utils.translation import ugettext as _
@@ -1178,7 +1179,8 @@ def convert_wiki_link(content, group, repo_id, username):
# convert other types of filelinks to clickable links
path = "/" + linkname
icon = file_icon_filter(linkname)
s = reverse('repo_view_file', args=[repo_id]) + '?p=' + path
s = reverse('repo_view_file', args=[repo_id]) + \
'?p=' + urllib2.quote(smart_str(path))
a_tag = '''<img src="%simg/file/%s" alt="%s" class="vam" /> <a href='%s' target='_blank' class="vam">%s</a>'''
return a_tag % (MEDIA_URL, icon, icon, s, linkname)