Skip to content

Commit 4391db2

Browse files
added a route to download node metadata (#11215)
## Purpose So right now, our firewall rules aren't advanced enough to be able to let requests from `/<guid>/metadata` go through to osf on staging4. Instead, we have to start with a stable string, and do the dynamic part afterward, hence doing `/metadata/<guid>/` which we can match with `/metadata/*` in the firewall. ## Changes Added a corresponding route ## Ticket https://openscience.atlassian.net/browse/ENG-8261
1 parent 6062cef commit 4391db2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

website/routes.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,12 @@ def make_url_map(app):
412412
website_views.dashboard,
413413
notemplate
414414
),
415-
415+
Rule(
416+
'/metadata/<guid>/',
417+
'get',
418+
website_views.metadata_download,
419+
notemplate
420+
),
416421
Rule(
417422
'/myprojects/',
418423
'get',

website/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,9 @@ def guid_metadata_download(guid, resource, metadata_format):
434434
'Content-Disposition': f'attachment; filename={result.filename}',
435435
},
436436
)
437+
438+
439+
def metadata_download(guid):
440+
format_arg = request.args.get('format', 'datacite-json')
441+
resource = Guid.load(guid)
442+
return guid_metadata_download(guid, resource, format_arg)

0 commit comments

Comments
 (0)