mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 16:10:26 +00:00
Quote url path
This commit is contained in:
@@ -14,6 +14,7 @@ from django.http import HttpResponse, HttpResponseRedirect, Http404, \
|
|||||||
from django.shortcuts import render_to_response, redirect
|
from django.shortcuts import render_to_response, redirect
|
||||||
from django.template import Context, loader, RequestContext
|
from django.template import Context, loader, RequestContext
|
||||||
from django.template.loader import render_to_string
|
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.hashcompat import md5_constructor
|
||||||
from django.utils.http import urlquote
|
from django.utils.http import urlquote
|
||||||
from django.utils.translation import ugettext as _
|
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
|
# convert other types of filelinks to clickable links
|
||||||
path = "/" + linkname
|
path = "/" + linkname
|
||||||
icon = file_icon_filter(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>'''
|
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)
|
return a_tag % (MEDIA_URL, icon, icon, s, linkname)
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ from django.http import HttpResponse, HttpResponseBadRequest, Http404, \
|
|||||||
from django.shortcuts import render_to_response, redirect
|
from django.shortcuts import render_to_response, redirect
|
||||||
from django.template import Context, loader, RequestContext
|
from django.template import Context, loader, RequestContext
|
||||||
from django.template.loader import render_to_string
|
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.hashcompat import md5_constructor
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from seaserv import list_dir_by_path, get_repo, web_get_access_token, \
|
from seaserv import list_dir_by_path, get_repo, web_get_access_token, \
|
||||||
@@ -245,7 +246,8 @@ def convert_md_link(file_content, repo_id, username):
|
|||||||
# convert other types of filelinks to clickable links
|
# convert other types of filelinks to clickable links
|
||||||
path = "/" + linkname
|
path = "/" + linkname
|
||||||
icon = file_icon_filter(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>'''
|
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)
|
return a_tag % (MEDIA_URL, icon, icon, s, linkname)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user