Skip to content

Commit

Permalink
Allow deposition files be specified from CLI (as in the tutorial) or …
Browse files Browse the repository at this point in the history
…config file
  • Loading branch information
led02 committed Mar 6, 2024
1 parent 319c7d5 commit 96a713c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hermes/commands/deposit/invenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ class InvenioDepositSettings(BaseModel):
embargo_date: str = None
access_conditions: str = None
api_paths: t.Dict = {}
auth_token: str = None
files: list[pathlib.Path] = None
auth_token: str = ''
files: list[pathlib.Path] = []

record_id: int = None
doi: str = None
Expand Down Expand Up @@ -415,13 +415,13 @@ def upload_artifacts(self) -> None:

bucket_url = self.links["bucket"]

files: list[click.Path] = self.config.files
files = *self.config.files, *[f[0] for f in self.command.args.file]
for path_arg in files:
path = Path(path_arg)

# This should not happen, as Click shall not accept dirs as arguments already. Zero trust anyway.
if not path.is_file():
raise ValueError("Any given argument to be included in the deposit must be a file.")
raise ValueError(f"{path}: Any given argument to be included in the deposit must be a file.")

with open(path, "rb") as file_content:
response = self.client.put(
Expand Down

0 comments on commit 96a713c

Please sign in to comment.