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

improved source file edit

This commit is contained in:
llj
2012-08-07 11:47:10 +08:00
parent ae1dbd49bd
commit c8887461b1
2 changed files with 8 additions and 7 deletions

View File

@@ -883,15 +883,12 @@ def repo_file_get(request, repo_id):
data = json.dumps({'error': err})
return HttpResponse(data, status=400, content_type=content_type)
else:
# l, d = [], {}
try:
u_content = content.decode('utf-8')
except:
# XXX: file in windows is encoded in gbk
u_content = content.decode('gbk')
from django.utils.html import escape
# d['content'] = escape(u_content)
# l.append(d)
data = json.dumps({'content': u_content})
return HttpResponse(data, status=200, content_type=content_type)
@@ -934,7 +931,6 @@ def repo_file_edit(request, repo_id):
token = ''
if access_to_repo(request, repo_id, ''):
# Get a token to visit file
token = gen_token()
seafserv_rpc.web_save_access_token(token, repo_id, obj_id,
'view', request.user.username)