Skip to content

Commit

Permalink
404 when there's no PDD or when it's mis-requested
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-Eardley committed Aug 31, 2023
1 parent 90fce1b commit a2a310f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions portality/view/doaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,13 @@ def public_data_dump_redirect(record_type):
if not current_user.has_role(constants.ROLE_PUBLIC_DATA_DUMP):
abort(404)

target_data = models.Cache.get_public_data_dump().get(record_type, {})
if target_data is None:
# Make sure the PDD exists
pdd = models.Cache.get_public_data_dump()
if pdd is None:
abort(404)

target_data = pdd.get(record_type, {})
if not target_data:
abort(404)

main_store = store.StoreFactory.get(constants.STORE__SCOPE__PUBLIC_DATA_DUMP)
Expand Down

0 comments on commit a2a310f

Please sign in to comment.