Skip to content

Commit 0937548

Browse files
committed
Add support for deeper ../ links (Issue #534)
1 parent b4ded8a commit 0937548

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

htmldoc/htmllib.cxx

+10-5
Original file line numberDiff line numberDiff line change
@@ -3634,14 +3634,19 @@ htmlFixLinks(tree_t *doc, // I - Top node
36343634
char parent[1024], *pptr; // Parent directory
36353635

36363636
strlcpy(parent, (char *)base, sizeof(parent));
3637-
if ((pptr = strrchr(parent, '/')) != NULL)
3638-
pptr[1] = '\0';
3639-
else
3640-
parent[0] = '\0';
3637+
while (!strncmp((char *)href, "../", 3))
3638+
{
3639+
href += 3;
3640+
3641+
if ((pptr = strrchr(parent, '/')) != NULL)
3642+
pptr[1] = '\0';
3643+
else
3644+
parent[0] = '\0';
3645+
}
36413646

36423647
DEBUG_printf(("htmlFixLinks: Subdirectory, parent=\"%s\"\n", parent));
36433648

3644-
snprintf(full_href, sizeof(full_href), "%s%s", parent, href + 3);
3649+
snprintf(full_href, sizeof(full_href), "%s%s", parent, href);
36453650
}
36463651
else
36473652
{

0 commit comments

Comments
 (0)