@@ -212,12 +212,12 @@ class DataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
212212 """
213213
214214 # Init inputspec data attributes
215- base_directory = Directory (desc = "Path to the base directory for storing data." )
215+ base_directory = Str (desc = "Path to the base directory for storing data." )
216216 container = Str (desc = "Folder within base directory in which to store output" )
217217 parameterization = traits .Bool (
218218 True , usedefault = True , desc = "store output in parametrized structure"
219219 )
220- strip_dir = Directory (desc = "path to strip out of filename" )
220+ strip_dir = Str (desc = "path to strip out of filename" )
221221 substitutions = InputMultiPath (
222222 traits .Tuple (Str , Str ),
223223 desc = (
@@ -440,24 +440,18 @@ def _check_s3_base_dir(self):
440440 is not a valid S3 path, defaults to '<N/A>'
441441 """
442442
443- # NOTE: due to pathlib.Path in traits.Directory, S3 bucket paths
444- # follow the format 's3:/bucket_name/...'
445- s3_str = "s3:/"
443+ s3_str = "s3://"
446444 bucket_name = "<N/A>"
447445 base_directory = self .inputs .base_directory
448446
449447 if not isdefined (base_directory ):
450448 s3_flag = False
451449 return s3_flag , bucket_name
452450
453- # Check for 's3:/' in base dir
454- if base_directory .lower ().startswith (s3_str ):
455- bucket_name = base_directory [len (s3_str ):].split ("/" )[0 ]
456- s3_flag = True
457- else :
458- s3_flag = False
451+ s3_flag = base_directory .lower ().startswith (s3_str )
452+ if s3_flag :
453+ bucket_name = base_directory [len (s3_str ):].partition ('/' )[0 ]
459454
460- # Return s3_flag
461455 return s3_flag , bucket_name
462456
463457 # Function to return AWS secure environment variables
@@ -611,14 +605,12 @@ def _upload_to_s3(self, bucket, src, dst):
611605
612606 from botocore .exceptions import ClientError
613607
614- # NOTE: due to pathlib.Path in traits.Directory, S3 bucket paths
615- # follow the format 's3:/bucket_name/...'
616- s3_str = "s3:/"
608+ s3_str = "s3://"
617609 s3_prefix = s3_str + bucket .name
618610
619611 # Explicitly lower-case the "s3"
620- if dst [: len ( s3_str )] .lower () == s3_str :
621- dst = s3_str + dst [len (s3_str ) :]
612+ if dst .lower (). startswith ( s3_str ) :
613+ dst = s3_str + dst [len (s3_str ):]
622614
623615 # If src is a directory, collect files (this assumes dst is a dir too)
624616 if os .path .isdir (src ):
0 commit comments