Right now because new datasets end up with magda-ds as their id prefix, they're interpreted as being CKAN datasets by the CKAN redirection router (which assumes everything that doesn't start with ds- is a CKAN dataset, and as such end up looked up according to CKAN and 404ing.
We need to either make it so new datasets start with ds instead of magda-ds, or make the CKAN redirection smarter.
Problem reproduction steps
Create a new dataset
Go to that dataset in a browser
Hit refresh
😢
Proposed New Flow (when CKAN redirection turned on)
Request for CKAN dataset with CKAN slug comes in (e.g. /dataset/wyndam-bins)
CKAN redirection module checks in registry if we have a dataset with that ID (wyndam-bins). If we do, just let it go through (no redirection). If we don't:
Use CKAN api to look up dataset (e.g. /api/3/action/package_show?id=wyndham-bins). If we get a result, pull the actual CKAN ID off the CKAN dataset and use that to look up the matching dataset in the registry.
If we can find a dataset in the registry with that CKAN id, redirect to that dataset
If we can't, 404
If the CKAN API 404s, return a 404 (or redirect to error, whatever the current behaviour is) as usual
Problem description
Right now because new datasets end up with
magda-ds
as their id prefix, they're interpreted as being CKAN datasets by the CKAN redirection router (which assumes everything that doesn't start withds-
is a CKAN dataset, and as such end up looked up according to CKAN and404
ing.We need to either make it so new datasets start with
ds
instead ofmagda-ds
, or make the CKAN redirection smarter.Problem reproduction steps
Proposed New Flow (when CKAN redirection turned on)
/dataset/wyndam-bins
)/api/3/action/package_show?id=wyndham-bins
). If we get a result, pull the actual CKAN ID off the CKAN dataset and use that to look up the matching dataset in the registry.