fix: decode URI components before path processing
Ensure path normalization and encoding handle URI-encoded segments correctly by decoding them first.
This commit is contained in:
parent
e6d74cc318
commit
45c8722af8
|
|
@ -101,7 +101,7 @@ export const RevealManager: Component = () => {
|
||||||
const state = journalStreamState;
|
const state = journalStreamState;
|
||||||
if (!dom || state.myRole !== "gm" || !state.connected) return;
|
if (!dom || state.myRole !== "gm" || !state.connected) return;
|
||||||
|
|
||||||
const normalized = normalizePath(location.pathname);
|
const normalized = normalizePath(decodeURIComponent(location.pathname));
|
||||||
const data = comp.data;
|
const data = comp.data;
|
||||||
|
|
||||||
// Spark tables on this page — matched by suffix on column slug.
|
// Spark tables on this page — matched by suffix on column slug.
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ function fileNameFromPath(path: string): string {
|
||||||
|
|
||||||
/** Encode a path, preserving / separators but encoding each segment */
|
/** Encode a path, preserving / separators but encoding each segment */
|
||||||
function encodePath(path: string): string {
|
function encodePath(path: string): string {
|
||||||
return path
|
// Decode first in case the path is already URL-encoded (defense-in-depth)
|
||||||
|
return decodeURIComponent(path)
|
||||||
.split("/")
|
.split("/")
|
||||||
.map((seg) => encodeURIComponent(seg))
|
.map((seg) => encodeURIComponent(seg))
|
||||||
.join("/");
|
.join("/");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue