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:
@@ -27,7 +27,8 @@ function fileNameFromPath(path: string): string {
|
||||
|
||||
/** Encode a path, preserving / separators but encoding each segment */
|
||||
function encodePath(path: string): string {
|
||||
return path
|
||||
// Decode first in case the path is already URL-encoded (defense-in-depth)
|
||||
return decodeURIComponent(path)
|
||||
.split("/")
|
||||
.map((seg) => encodeURIComponent(seg))
|
||||
.join("/");
|
||||
|
||||
Reference in New Issue
Block a user