Document changing host for rotating-url
and assume same version based only on checksum and file size
#439
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.
Description
Hey there,
Motivation
The Flatpak projects for Discord, War Thunder seen multiple PR for the same version number, because of a changed URL. This behavior could indicate load-balancing. The hash and version number stays the same, which you can see in the referenced PRs.
Changes
Documentation
in this PR I added some documentation on how to use non-capturing groups to allow the pattern to match despite the changing host. The use of non-capturing groups then doesn't cause conflicts with the version extraction of the first capturing version group.
urlchecker
I adjusted the
is_update
parameter to compare the version numbers if they could be extracted to reflect that it's still the same version. Nevertheless, this change doesn't stop this project from reporting a new update without the changes below.externaldata
I dropped the URL comparison in
ExternalFile
s to rely only on checksum and file size to report identical files. Without this changematches
andis_same_version
both uses the URL and therefore reportFalse
and program flow goes intoself.new_version = new_version
and so reports... got new version
although the version is still up to date.flatpak-external-data-checker/src/lib/externaldata.py
Lines 284 to 290 in a01c775
Alternatives
The changes mentioned will affect all sources that uses
ExternalFile
to rely only on checksum and size. An alternative would be to modifyExternalFile.is_same_version
which uses url compares too, which seems to be a better based on the name. However, this wouldn't work forAppImage
s, because then we would need to download the old/current version again to extract that version number.Testing
I used Discord's project for validation with the following changes:
Related
rotating-url
behavior? #438