fix: remove all staging files for submission (#8535)
This commit is contained in:
parent
853de88546
commit
04952d58fa
|
@ -671,20 +671,16 @@ def move_files_to_repository(submission):
|
|||
raise ValueError("Intended to move '%s' to '%s', but found source and destination missing.")
|
||||
|
||||
|
||||
def remove_staging_files(name, rev, exts=None):
|
||||
"""Remove staging files corresponding to a submission
|
||||
|
||||
exts is a list of extensions to be removed. If None, defaults to settings.IDSUBMIT_FILE_TYPES.
|
||||
"""
|
||||
if exts is None:
|
||||
exts = [f'.{ext}' for ext in settings.IDSUBMIT_FILE_TYPES]
|
||||
def remove_staging_files(name, rev):
|
||||
"""Remove staging files corresponding to a submission"""
|
||||
basename = pathlib.Path(settings.IDSUBMIT_STAGING_PATH) / f'{name}-{rev}'
|
||||
exts = [f'.{ext}' for ext in settings.IDSUBMIT_FILE_TYPES]
|
||||
for ext in exts:
|
||||
basename.with_suffix(ext).unlink(missing_ok=True)
|
||||
|
||||
|
||||
def remove_submission_files(submission):
|
||||
remove_staging_files(submission.name, submission.rev, submission.file_types.split(','))
|
||||
remove_staging_files(submission.name, submission.rev)
|
||||
|
||||
|
||||
def approvable_submissions_for_user(user):
|
||||
|
|
Loading…
Reference in a new issue