mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Merge pull request #1905 from dannon/library_errors
[16.01] Encoding in libraries
This commit is contained in:
@@ -6,7 +6,7 @@ import time
|
||||
import hashlib
|
||||
from galaxy import exceptions
|
||||
from galaxy.web import _future_expose_api as expose_api
|
||||
from galaxy.util import jstree
|
||||
from galaxy.util import jstree, unicodify
|
||||
from galaxy.web.base.controller import BaseAPIController
|
||||
from operator import itemgetter
|
||||
|
||||
@@ -132,20 +132,18 @@ class RemoteFilesAPIController( BaseAPIController ):
|
||||
jstree_paths = []
|
||||
if os.path.exists( directory ):
|
||||
for ( dirpath, dirnames, filenames ) in os.walk( directory ):
|
||||
|
||||
for dirname in dirnames:
|
||||
dir_path = os.path.relpath( os.path.join( dirpath, dirname ), directory )
|
||||
dir_path_hash = hashlib.sha1( dir_path.encode('utf-8') ).hexdigest()
|
||||
dir_path_hash = hashlib.sha1(unicodify(dir_path).encode('utf-8')).hexdigest()
|
||||
disabled = True if disable == 'folders' else False
|
||||
jstree_paths.append( jstree.Path( dir_path, dir_path_hash, { 'type': 'folder', 'state': { 'disabled': disabled }, 'li_attr': { 'full_path': dir_path } } ) )
|
||||
|
||||
for filename in filenames:
|
||||
file_path = os.path.relpath( os.path.join( dirpath, filename ), directory )
|
||||
file_path_hash = hashlib.sha1( file_path.encode('utf-8') ).hexdigest()
|
||||
file_path_hash = hashlib.sha1(unicodify(file_path).encode('utf-8')).hexdigest()
|
||||
disabled = True if disable == 'files' else False
|
||||
jstree_paths.append( jstree.Path( file_path, file_path_hash, { 'type': 'file', 'state': { 'disabled': disabled }, 'li_attr': { 'full_path': file_path } } ) )
|
||||
else:
|
||||
raise exceptions.ConfigDoesNotAllowException( 'The given directory does not exist.' )
|
||||
|
||||
userdir_jstree = jstree.JSTree( jstree_paths )
|
||||
return userdir_jstree
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</%def>
|
||||
|
||||
<%
|
||||
from cgi import escape
|
||||
from galaxy import util
|
||||
if trans.user_is_admin() and cntrller == 'library_admin':
|
||||
can_add = can_modify = can_manage = True
|
||||
elif cntrller in [ 'library', 'requests' ]:
|
||||
@@ -16,9 +16,9 @@
|
||||
can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, library )
|
||||
else:
|
||||
can_add = can_modify = can_manage = False
|
||||
library_name = escape( str( library.name ), quote=True )
|
||||
library_description = escape( str( library.description ), quote=True )
|
||||
library_synopsis = escape( str( library.synopsis ), quote=True )
|
||||
library_name = util.unicodify( library.name )
|
||||
library_description = util.unicodify(library.description)
|
||||
library_synopsis = util.unicodify(library.synopsis)
|
||||
%>
|
||||
|
||||
<br/><br/>
|
||||
@@ -63,14 +63,14 @@
|
||||
<div class="form-row">
|
||||
<label>Name:</label>
|
||||
<div style="float: left; width: 250px; margin-right: 10px;">
|
||||
<input type="text" name="name" value="${library_name}" size="40"/>
|
||||
<input type="text" name="name" value="${library_name | h}" size="40"/>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>Description:</label>
|
||||
<div style="float: left; width: 250px; margin-right: 10px;">
|
||||
<input type="text" name="description" value="${library_description}" size="40"/>
|
||||
<input type="text" name="description" value="${library_description | h}" size="40"/>
|
||||
</div>
|
||||
<div class="toolParamHelp" style="clear: both;">
|
||||
Displayed when browsing all libraries
|
||||
@@ -80,7 +80,7 @@
|
||||
<div class="form-row">
|
||||
<label>Synopsis:</label>
|
||||
<div style="float: left; width: 250px; margin-right: 10px;">
|
||||
<input type="text" name="synopsis" value="${library_synopsis}" size="40"/>
|
||||
<input type="text" name="synopsis" value="${library_synopsis | h}" size="40"/>
|
||||
</div>
|
||||
<div class="toolParamHelp" style="clear: both;">
|
||||
Displayed when browsing this library
|
||||
@@ -94,17 +94,17 @@
|
||||
%else:
|
||||
<div class="form-row">
|
||||
<label>Name:</label>
|
||||
${library_name}
|
||||
${library_name | h}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<div class="form-row">
|
||||
<label>Description:</label>
|
||||
${library_description}
|
||||
${library_description | h}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<div class="form-row">
|
||||
<label>Synopsis:</label>
|
||||
${library_synopsis}
|
||||
${library_synopsis | h}
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
%endif
|
||||
|
||||
Reference in New Issue
Block a user