Support fallback URLs for netkan validate-ckan #3060
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.
Problem
If you submit a CKAN-meta pull request for a module that currently relies on its archive.org fallback URL for download, the pull request validation will fail, even though the module can be installed by the client.
Cause
Netkan uses a downloading service separate from the client's, which does not know about fallback URLs.
Changes
Metadata
provides aFallbackDownload
property that returns an archive.orgUri
if we have enough info to do so andnull
otherwise.CachingHttpService
takesMetadata
as input when downloading instead of aUri
, identifier, and timestamp separately.CachingHttpService
attempts to getFallbackDownload
if it is set, and propagates the exception otherwise.This will allow
netkan.exe --validate-ckan
to access fallback URLs and pass validation for modules relying on them.NOTE: I just realized I forgot to check for redistributable licenses. I'll start that and remove the "In Progress" label when done.
NOTE: Also, the cache entries should be stored according to the original URL, not the fallback. Consider this pending as well.
Fixes #2938.