Support new Curse URLs with non-numeric IDs #2464
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The format of Curse API URLs changed recently, but some old URLs are still supported; see the discussion in KSP-CKAN/NetKAN#6608 for details.
Old format:
New format:
Any old URL that had been accessed before March 2018 still works thanks to caching internal to the API, but any newly added mod must use the new format.
Problem
Netkan fails on mods added to curse after March 2018. See KSP-CKAN/NetKAN#6608 for an example; PhotonSailor can't be indexed without updating our Curse API logic.
(UPDATE: We switched that mod to SpaceDock instead, so the urgency is lower, but the problem would still affect future new mods hosted only on Curse.)
Changes
Now the
id
part of the#/ckan/curse/id
kref string may contain either a number or a non-number. If it's a number, the old format URL is used for backwards compatibility with existing metadata. If it's not a number, then the new format is used.In addition, the Netkan log message that prints the API URL being accessed is promoted from debug to info, so it can be seen when
--verbose
is enabled.A test is added to exercise the new format.