Changeset - 7425088bc4ff
[Not reviewed]
stable
0 3 0
Takumi IINO - 10 years ago 2015-11-23 11:01:22
trot.thunder@gmail.com
gist: fix unicode file path handling
3 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/gists.py
Show inline comments
 
@@ -42,7 +42,7 @@ from kallithea.lib import helpers as h
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.auth import LoginRequired, NotAnonymous
 
from kallithea.lib.utils import jsonify
 
from kallithea.lib.utils2 import safe_int, time_to_datetime
 
from kallithea.lib.utils2 import safe_int, safe_unicode, time_to_datetime
 
from kallithea.lib.helpers import Page
 
from webob.exc import HTTPNotFound, HTTPForbidden
 
from sqlalchemy.sql.expression import or_
 
@@ -206,7 +206,7 @@ class GistsController(BaseController):
 
            log.error(traceback.format_exc())
 
            raise HTTPNotFound()
 
        if format == 'raw':
 
            content = '\n\n'.join([f.content for f in c.files if (f_path is None or f.path == f_path)])
 
            content = '\n\n'.join([f.content for f in c.files if (f_path is None or safe_unicode(f.path) == f_path)])
 
            response.content_type = 'text/plain'
 
            return content
 
        return render('admin/gists/show.html')
kallithea/templates/admin/gists/edit.html
Show inline comments
 
@@ -69,8 +69,8 @@
 
            % for cnt, file in enumerate(c.files):
 
                <div id="body" class="codeblock" style="margin-bottom: 4px">
 
                    <div style="padding: 10px 10px 10px 26px;color:#666666">
 
                        <input type="hidden" value="${file.path}" name="org_files">
 
                        <input id="filename_${h.FID('f',file.path)}" name="files" size="30" type="text" value="${file.path}">
 
                        <input type="hidden" value="${h.safe_unicode(file.path)}" name="org_files">
 
                        <input id="filename_${h.FID('f',file.path)}" name="files" size="30" type="text" value="${h.safe_unicode(file.path)}">
 
                        <select id="mimetype_${h.FID('f',file.path)}" name="mimetypes"/>
 
                    </div>
 
                    <div class="editor_container">
kallithea/templates/admin/gists/show.html
Show inline comments
 
@@ -81,9 +81,9 @@
 
               <div style="border: 1px solid #EEE;margin-top:20px">
 
                <div id="${h.FID('G', file.path)}" class="stats" style="border-bottom: 1px solid #DDD;padding: 8px 14px;">
 
                    <a href="${c.gist.gist_url()}">ΒΆ</a>
 
                    <b style="margin:0px 0px 0px 4px">${file.path}</b>
 
                    <b style="margin:0px 0px 0px 4px">${h.safe_unicode(file.path)}</b>
 
                    <div style="float:right; margin: -5px">
 
                       ${h.link_to(_('Show as raw'),h.url('formatted_gist_file', gist_id=c.gist.gist_access_id, format='raw', revision=file.changeset.raw_id, f_path=file.path),class_="btn btn-mini")}
 
                       ${h.link_to(_('Show as raw'),h.url('formatted_gist_file', gist_id=c.gist.gist_access_id, format='raw', revision=file.changeset.raw_id, f_path=h.safe_unicode(file.path)),class_="btn btn-mini")}
 
                    </div>
 
                </div>
 
                <div class="code-body">
0 comments (0 inline, 0 general)