Skip to content

Document changing host for rotating-url and assume same version based only on checksum and file size#439

Merged
bbhtt merged 3 commits intoflathub-infra:masterfrom
TuxCoding:rotating-url
Apr 23, 2026
Merged

Document changing host for rotating-url and assume same version based only on checksum and file size#439
bbhtt merged 3 commits intoflathub-infra:masterfrom
TuxCoding:rotating-url

Conversation

@TuxCoding
Copy link
Copy Markdown
Contributor

@TuxCoding TuxCoding commented Sep 18, 2024

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.

-        url: https://cdnnow-distr.gaijinent.com/wt_launcher_linux_1.0.3.15.tar.gz
+        url: https://aws-yup-distr-02.gaijinent.com/wt_launcher_linux_1.0.3.15.tar.gz
         sha256: c89e4a41185bfaab634a978a0eac9752c42fea1afb6c094692063ceb40760e15

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 ExternalFiles to rely only on checksum and file size to report identical files. Without this change matches and is_same_version both uses the URL and therefore report False and program flow goes into self.new_version = new_version and so reports ... got new version although the version is still up to date.

elif is_update:
log.info(
"Source %s: got new version %s", self.filename, new_version.version
)
self.state |= self.State.OUTDATED
self.new_version = new_version

Alternatives

The changes mentioned will affect all sources that uses ExternalFile to rely only on checksum and size. An alternative would be to modify ExternalFile.is_same_version which uses url compares too, which seems to be a better based on the name. However, this wouldn't work for AppImages, 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:

[...]
                    "x-checker-data": {
[...]
                        "pattern": "https://(?:dl|stable.dl\\d).discordapp.net/apps/linux/([0-9.]+)/discord-([0-9.]+).tar.gz"
                    }
[...]

Related

Fixes #438

@bbhtt
Copy link
Copy Markdown
Contributor

bbhtt commented Oct 12, 2025

I guess this works, but I think checking that the final URL matches the pattern would be better?

Also can you also clean-up the commit history (squash the formatting commit) and rebase to main?

@bbhtt bbhtt force-pushed the rotating-url branch 2 times, most recently from c193fa2 to 0a4ca48 Compare April 23, 2026 02:30
Co-authored-by: bbhtt <bbhtt.zn0i8@slmail.me>
@bbhtt
Copy link
Copy Markdown
Contributor

bbhtt commented Apr 23, 2026

Looks like you updated your GitHub username and thus the email. I changed it to your current ones to get the authorship correctly rendered.

Comment thread src/checkers/urlchecker.py Outdated
TuxCoding and others added 2 commits April 23, 2026 08:15
Compare extracted version strings when available between current and
new URLs to detect identical releases behind rotating or load-balanced
URLs and fall back to URL comparison if version extraction fails.

Co-authored-by: bbhtt <bbhtt.zn0i8@slmail.me>
This can happen if the url for downloading changed
(i.e. load-balancing),but the actual application is still the same.
@bbhtt bbhtt enabled auto-merge (rebase) April 23, 2026 02:47
@bbhtt bbhtt merged commit 34352a5 into flathub-infra:master Apr 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rotating-url checker should respect input pattern

2 participants