fixed the bag unzip content empty issue
@@ -2735,8 +2735,16 @@ def get_resource_file_path(resource, filename, folder=''):
# cannot only test folder string to start with resource.root_path, since a relative folder path
# may start with the resource's uuid if the same resource bag is added into the same resource and unzipped
# into the resource as in the bug reported in this issue: https://github.com/hydroshare/hydroshare/issues/2984
- if folder is not None and folder.startswith(os.path.join(resource.root_path, 'data', 'contents')):
+
+ res_data_content_path = os.path.join(resource.root_path, 'data', 'contents')
+ if folder is not None and folder.startswith(res_data_content_path):
# TODO: does this now start with /?
+ # check if the folder is a path relative to the resource data content path, if yes, no need to strip out
+ # resource.root_path
+ istorage = resource.get_irods_storage()
+ if not istorage.exists(os.path.join(res_data_content_path, folder)):
+ # folder is not a path relative to res_data_content_path, but a path including resource root path,
+ # strip out resource root path to make folder a relative path
folder = folder[len(resource.root_path):]
# retrieve federation path -- if any -- from Resource object containing the file
