mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #939 from nsoranzo/debug_for_792
Add a log.warn() if extracted file does not exist when changing permissions.
This commit is contained in:
@@ -53,7 +53,7 @@ class CompressedFile( object ):
|
||||
def extract( self, path ):
|
||||
'''Determine the path to which the archive should be extracted.'''
|
||||
contents = self.getmembers()
|
||||
extraction_path = os.path.join( path )
|
||||
extraction_path = path
|
||||
common_prefix = ''
|
||||
if len( contents ) == 1:
|
||||
# The archive contains a single file, return the extraction path.
|
||||
@@ -84,8 +84,11 @@ class CompressedFile( object ):
|
||||
external_attributes = self.archive.getinfo( filename ).external_attr
|
||||
# The 2 least significant bytes are irrelevant, the next two contain unix permissions.
|
||||
unix_permissions = external_attributes >> 16
|
||||
if unix_permissions != 0 and os.path.exists( absolute_filepath ):
|
||||
os.chmod( absolute_filepath, unix_permissions )
|
||||
if unix_permissions != 0:
|
||||
if os.path.exists( absolute_filepath ):
|
||||
os.chmod( absolute_filepath, unix_permissions )
|
||||
else:
|
||||
log.warn("Unable to change permission on extracted file '%s' as it does not exist" % absolute_filepath)
|
||||
return os.path.abspath( os.path.join( extraction_path, common_prefix ) )
|
||||
|
||||
def getmembers_tar( self ):
|
||||
|
||||
Reference in New Issue
Block a user