Skip to content

Commit

Permalink
login: Fix quote removal in brand name
Browse files Browse the repository at this point in the history
Don't cut off the last character from brand names if they are enclosed
in quotes.

https://issues.redhat.com/browse/COCKPIT-1219
https://issues.redhat.com/browse/RHEL-72582
  • Loading branch information
martinpitt authored and mvollmer committed Jan 8, 2025
1 parent b824371 commit 6b68c56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/static/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function debug(...args) {
const len = content.length;
if ((content[0] === '"' || content[0] === '\'') &&
len > 2 && content[len - 1] === content[0])
content = content.substring(1, len - 2);
content = content.substring(1, len - 1);
elt.innerHTML = content || def;
} else {
elt.removeAttribute("class");
Expand Down
12 changes: 12 additions & 0 deletions test/verify/check-connection
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,18 @@ until pgrep -f '^(/usr/[^ ]+/[^ /]*python[^ /]* )?/usr/bin/cockpit-bridge'; do s
b.wait_visible("#login")
b.assert_pixels("body", "login-screen")

# our supported OSes should all have branding make sure it matches os-release
if m.image.startswith("ubuntu"):
# reflects src/branding/ubuntu/branding.scss
expected = m.execute('. /usr/lib/os-release; echo "$PRETTY_NAME"').strip()
else:
expected = m.execute('. /usr/lib/os-release; echo "$NAME $VARIANT"').strip()
# quirk: trailing space hard to avoid due to the empty variant wrapped in <b>
if m.image == 'arch':
expected += ' '

b.wait_text("#brand", expected)

@testlib.skipOstree("tests cockpit-ws package")
@testlib.skipWsContainer("tests cockpit-ws package")
@testlib.nondestructive
Expand Down

0 comments on commit 6b68c56

Please sign in to comment.