From b1dd7eeaa0dd30a1b2bbcaaa12b57b430127df35 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 1 Mar 2012 09:31:18 -0500 Subject: [PATCH] Quick fix for ftp upload unicode normalization failure. TODO: Refactor, shouldn't happen this way. --- lib/galaxy/tools/parameters/grouping.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/parameters/grouping.py b/lib/galaxy/tools/parameters/grouping.py index 5332372bbd6..054b2cd5bb5 100644 --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -309,7 +309,7 @@ class UploadDataset( Group ): if ftp_files is not None: # Normalize input paths to ensure utf-8 encoding is normal form c. # This allows for comparison when the filesystem uses a different encoding than the browser. - ftp_files = [unicodedata.normalize('NFC', f) for f in ftp_files] + ftp_files = [unicodedata.normalize('NFC', f) for f in ftp_files if isinstance(f, unicode)] if trans.user is None: log.warning( 'Anonymous user passed values in ftp_files: %s' % ftp_files ) ftp_files = [] @@ -321,7 +321,11 @@ class UploadDataset( Group ): path = relpath( os.path.join( dirpath, filename ), user_ftp_dir ) if not os.path.islink( os.path.join( dirpath, filename ) ): # Normalize filesystem paths - valid_files.append( unicodedata.normalize('NFC', path )) + if isinstance(path, unicode): + valid_files.append(unicodedata.normalize('NFC', path )) + else: + valid_files.append(path) + else: ftp_files = [] for ftp_file in ftp_files: