1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 15:19:06 +00:00

Encode wiki name in url

This commit is contained in:
zhengxie
2013-04-02 19:39:30 +08:00
parent a4c8d8f9fa
commit 12dae03ad5
3 changed files with 10 additions and 7 deletions

View File

@@ -103,7 +103,7 @@ $('#page-list').click(function () {
});
$('#page-history').click(function () {
window.open("{% url 'file_revisions' repo_id %}" + "?p=" + "{{path}}");
window.open("{% url 'file_revisions' repo_id %}" + "?p=" + "{{path|urlencode}}");
});
addConfirmTo($('#page-delete'), {

View File

@@ -1349,8 +1349,9 @@ def group_wiki_page_new(request, group, page_name="home"):
if not post_empty_file(repo.id, "/", filename, request.user.username):
return render_error(request, _('Failed to create wiki page. Please retry later.'))
url = "%srepo/%s/file/edit/?p=%s&from=wiki_page_new&gid=%s" % \
(SITE_ROOT, repo.id, filepath, group.id)
url = "%s?p=%s&from=wiki_page_new&gid=%s" % (
reverse('file_edit', args=[repo.id]),
urllib2.quote(filepath.encode('utf-8')), group.id)
return HttpResponseRedirect(url)
@@ -1364,8 +1365,10 @@ def group_wiki_page_edit(request, group, page_name="home"):
return render_error(request, _('Wiki is not found.'))
filepath = "/" + page_name + ".md"
url = "%srepo/%s/file/edit/?p=%s&from=wiki_page_edit&gid=%s" % \
(SITE_ROOT, repo.id, filepath, group.id)
url = "%s?p=%s&from=wiki_page_edit&gid=%s" % (
reverse('file_edit', args=[repo.id]),
urllib2.quote(filepath.encode('utf-8')), group.id)
return HttpResponseRedirect(url)

View File

@@ -60,7 +60,7 @@ urlpatterns = patterns('',
url(r'^repo/(?P<repo_id>[-0-9a-f]{36})/history/files/$', view_history_file, name="view_history_file"),
url(r'^repo/(?P<repo_id>[-0-9a-f]{36})/trash/files/$', view_trash_file, name="view_trash_file"),
url(r'^repo/(?P<repo_id>[-0-9a-f]{36})/snapshot/files/$', view_snapshot_file, name="view_snapshot_file"),
(r'^repo/(?P<repo_id>[-0-9a-f]{36})/file/edit/$', file_edit),
url(r'^repo/(?P<repo_id>[-0-9a-f]{36})/file/edit/$', file_edit, name='file_edit'),
url(r'^repo/(?P<repo_id>[-0-9a-f]{36})/(?P<obj_id>[^/]+)/$', repo_access_file, name='repo_access_file'),
(r'^repo/save_settings$', repo_save_settings),