Skip to content

Commit

Permalink
Merge pull request quarkusio#40002 from phillip-kruger/dev-ui-title
Browse files Browse the repository at this point in the history
Fix url encoding issue for Dev UI Page with unusual chars
  • Loading branch information
gsmet authored Apr 11, 2024
2 parents 0bbbfdc + 5e95a7b commit 25a82a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export class RouterController {

addRoute(path, component, name, page, defaultRoute = false) {
path = this.getPageUrlFor(page);
var currentSelection = window.location.pathname;
const search = new URLSearchParams(window.location.search);
if (!this.isExistingPath(path)) {
RouterController.pageMap.set(path, page);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.quarkus.devui.spi.page;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;

/**
Expand Down Expand Up @@ -61,6 +64,12 @@ protected Page(String icon,

public String getId() {
String id = this.title.toLowerCase().replaceAll(SPACE, DASH);
try {
id = URLEncoder.encode(id, StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex);
}

if (!this.isInternal() && this.namespace != null) {
// This is extension pages in Dev UI
id = this.namespace.toLowerCase() + SLASH + id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public T title(String title) {

@SuppressWarnings("unchecked")
public T staticLabel(String staticLabel) {
this.staticLabel = staticLabel;
if (this.staticLabel == null) {
this.staticLabel = "";
}
this.staticLabel = this.staticLabel + " " + staticLabel;
return (T) this;
}

Expand Down

0 comments on commit 25a82a8

Please sign in to comment.