mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
refactor(tls): add url.origin and use it wherever url.base lost its trailing slash
lookup('tls', app, 'url.base') always ends in '/', and 39 call sites in 25 files rebuilt the slash-less form by hand with regex_replace('/$', ''), regex_replace('/+$', ''), trim('/') or .rstrip('/'), directly or on a variable holding url.base. The lookup now returns that value as url.origin (scheme://host, url.base minus its final '/'), and every call site reads it; two sites that stripped the slash only to append it again now take url.base as is, and GITLAB_URL and DASHBOARD_JS_CDN_URL lost their last consumer.
test_url_base_no_double_slash gains the rule url-base-strip, so url.origin stays the only way to the slash-less URL; it flags all nine HEAD sites probed and none after the change. The same lint keeps url-base-double-slash and url-base-addon-value, which put the nine Nextcloud integration URLs, the Mattermost and SuiteCRM facts and the XWiki instance on the slash-less form, drop the stray '/' before Joomla's index.php callback, and give BBB its api.url as [base, suffix] | url_join plus the trailing '/' its client appends 'api/<call>' to; bbb.spec.js now requires exactly that form.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
199d7fdcbf
commit
44aaa68924
44 files changed
+291
-56
No files matched your search
@@ -85,6 +85,16 @@ class TestTlsResolveLookup(unittest.TestCase):
|
||||
)[0]
|
||||
self.assertEqual(val, "https://a.example/")
|
||||
|
||||
def test_url_origin_is_the_base_url_without_its_trailing_slash(self):
|
||||
origin, base = (
|
||||
self.lookup.run(["web-app-a", want], variables=self.base_vars, mode="app")[
|
||||
0
|
||||
]
|
||||
for want in ("url.origin", "url.base")
|
||||
)
|
||||
self.assertEqual(origin, "https://a.example")
|
||||
self.assertEqual(f"{origin}/", base)
|
||||
|
||||
def test_protocols_web_path_is_http_for_an_onion_only_app(self):
|
||||
onion = dict(self.base_vars)
|
||||
onion["domains"] = {**self.domains, "web-app-onion": "abc123.onion"}
|
||||
|
||||
Reference in new issue
Block a user