Skip to content

Update URL_RE and COMBINED_RE to handle ports in package_repository definitions#22

Closed
desrod wants to merge 1 commit intocanonical:masterfrom
desrod:setuid-repository-regex-fix
Closed

Update URL_RE and COMBINED_RE to handle ports in package_repository definitions#22
desrod wants to merge 1 commit intocanonical:masterfrom
desrod:setuid-repository-regex-fix

Conversation

@desrod
Copy link

@desrod desrod commented Feb 3, 2026

This small bit of change updates the validation in package repo definitions to accept host:port URLs used by non-defualt Ubuintu mirrors. I took two stabs at the regex, one with a much toothier approach which allowed IPv4 addresses vs. domain names, and a leaner approach.

Toothy: https://regex101.com/r/yxbxSB/1
Less-toothy: https://regex101.com/r/yxbxSB/2

This PR includes the former for pedantic completeness.

Before
2026-02-03_15-00

After

2026-02-03_15-57

This also anchors the COMBINED_RE so the whole value as passed in must match either the PPA form or the URL form. With explicit ^... $ on the combined pattern, match() becomes equivalent to fullmatch() and avoids relying on subpattern anchoring behavior.

See internal MM thread for context: gr7kseaqyifpfqiyemxshyp4oc

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Thank you for your PR! The code on GitHub is a mirror only and we don't merge PRs here.
Please create an MP on Launchpad: https://launchpad.net/maas

@github-actions github-actions bot closed this Feb 3, 2026
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.

1 participant