Skip to content

Commit e483238

Browse files
authored
Update deposit.py
1 parent c8e31c4 commit e483238

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

addons/weko/deposit.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ def _build_ro_crate(self, crate):
3636
comment_ids = {}
3737
files = []
3838
for file in self.folder.get_files():
39-
_, children = self._create_file_entities(crate, self.node, './', file, user_ids, schema_ids, comment_ids)
39+
_, children = self._create_file_entities(crate, self.node, f'./', file, user_ids, schema_ids, comment_ids)
4040
files += children
4141
for _, _, comments in files:
4242
crate.add(*comments)
4343
return crate, files
4444

45+
4546
def _download(node, file, tmp_dir, total_size):
4647
if file.kind == 'file':
4748
_check_file_size(total_size + int(file.size))
@@ -72,7 +73,6 @@ def deposit_metadata(
7273
self, user_id, index_id, node_id, metadata_node_id,
7374
schema_id, file_metadatas, project_metadatas, metadata_paths, status_path, delete_after=False,
7475
):
75-
import os
7676
user = OSFUser.load(user_id)
7777
logger.info(f'Deposit: {metadata_paths}, {status_path} {self.request.id}')
7878
node = AbstractNode.load(node_id)
@@ -138,7 +138,6 @@ def deposit_metadata(
138138
'Packaging': 'http://purl.org/net/sword/3.0/package/SimpleZip',
139139
'Content-Disposition': 'attachment; filename=payload.zip',
140140
}
141-
142141
files = {
143142
'file': ('payload.zip', open(zip_path, 'rb'), 'application/zip'),
144143
}
@@ -153,7 +152,7 @@ def deposit_metadata(
153152
'progress': 100,
154153
'paths': metadata_paths,
155154
})
156-
links = [link for link in respbody['links'] if 'contentType' in link and '@id' in link and link['contentType'] == 'text/html']
155+
links = [l for l in respbody['links'] if 'contentType' in l and '@id' in l and l['contentType'] == 'text/html']
157156
for file in download_files:
158157
if delete_after:
159158
file.delete()

0 commit comments

Comments
 (0)