Skip to content

Commit 473b249

Browse files
committed
chmgen: Improve error message for links escaping site root
1 parent 1ff6299 commit 473b249

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

chmgen.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ string absoluteUrl(string base, string url)
585585
while (urlSegments.startsWith([`..`]))
586586
{
587587
urlSegments = urlSegments[1..$];
588+
enforce(pathSegments.length,
589+
"Attempting to escape site root (dereferencing %s from %s)"
590+
.format(url, base));
588591
pathSegments = pathSegments[0..$-1];
589592
}
590593
return (pathSegments ~ urlSegments).join(`/`);

0 commit comments

Comments
 (0)