save uploads under their key, not their title #18

Merged
adina merged 1 commit from adina/tools:pid into main 2026-02-10 11:46:55 +00:00

View file

@ -60,8 +60,8 @@ class AnnexRegistrator(object):
Compute the target path for a file in the repository.
# attachments/
# schema-type/
# pid/
# title.ext
# pid-distribution-of/
# key
:param info: A dictionary with information about the file
:param pid_transformation: A function to perform string substitution
to sanitize paths
@ -69,7 +69,7 @@ class AnnexRegistrator(object):
file_path =\
f'attachments/{pid_transformation(info["schema"])}/' \
f'{pid_transformation(info["pid"])}/' \
f'{pid_transformation(info["title"])}'
f'{pid_transformation(info["key"])}'
return file_path
def register(self) -> None:
@ -125,7 +125,7 @@ class AnnexRegistrator(object):
# TODO: change keys/placeholder later once structure of records is
# known
self.mapping[key] =\
{'title': dist_record.get('display_label', 'placeholder'),
{'key': key,
'schema': dist_record.get('schema_type', 'placeholder'),
'pid': dist_record.get('pid', 'placeholder'),
}