Skip to content

Commit

Permalink
fix(src/ipc/bridge.cc): fix dangling '?' and '#'
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Feb 7, 2024
1 parent 6143b0d commit b26ad16
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/ipc/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2613,7 +2613,15 @@ static void registerSchemeHandler (Router *router) {

if (mount.path.size() > 0) {
if (mount.resolution.redirect) {
auto redirectURL = resolved.path + "?" + parsedPath.queryString + "#" + parsedPath.fragment;
auto redirectURL = resolved.path;
if (parsedPath.queryString.size() > 0) {
redirectURL += "?" + parsedPath.queryString;
}

if (parsedPath.fragment.size() > 0) {
redirectURL += "#" + parsedPath.fragment;
}

auto redirectSource = String(
"<meta http-equiv=\"refresh\" content=\"0; url='" + redirectURL + "'\" />"
);
Expand All @@ -2637,7 +2645,15 @@ static void registerSchemeHandler (Router *router) {
} else if (path.size() == 0 && userConfig.contains("webview_default_index")) {
path = userConfig["webview_default_index"];
} else if (resolved.redirect) {
auto redirectURL = resolved.path + "?" + parsedPath.queryString + "#" + parsedPath.fragment;
auto redirectURL = resolved.path;
if (parsedPath.queryString.size() > 0) {
redirectURL += "?" + parsedPath.queryString;
}

if (parsedPath.fragment.size() > 0) {
redirectURL += "#" + parsedPath.fragment;
}

auto redirectSource = String(
"<meta http-equiv=\"refresh\" content=\"0; url='" + redirectURL + "'\" />"
);
Expand Down

0 comments on commit b26ad16

Please sign in to comment.