Skip to content

Commit 209843f

Browse files
committed
fix: add record files restriction option to enable cache-control header
1 parent 2cb7675 commit 209843f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

invenio_app_rdm/records_ui/views/records.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,12 @@ def record_file_download(pid_value, file_item=None, is_preview=False, **kwargs):
411411
obj = file_item._file.object_version
412412
emitter(current_app, record=file_item._record, obj=obj, via_api=False)
413413

414-
return file_item.send_file(as_attachment=download)
414+
if file_item._record.access.protection.files == "public":
415+
restricted = False
416+
else:
417+
restricted = True
418+
419+
return file_item.send_file(as_attachment=download, restricted=restricted)
415420

416421

417422
@pass_record_or_draft(expand=False)

0 commit comments

Comments
 (0)