mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fix URL conversion for colons in filenames
* src/convert.c (construct_relative): Prepend './' to filename * tests/Test-k.px: Amend test to succeed
This commit is contained in:
parent
71979f1643
commit
b14eeb5aee
@ -441,11 +441,21 @@ construct_relative (const char *basefile, const char *linkfile)
|
|||||||
++basedirs;
|
++basedirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!basedirs && (b = strpbrk (linkfile, "/:")) && *b == ':')
|
||||||
|
{
|
||||||
|
link = xmalloc (2 + strlen (linkfile) + 1);
|
||||||
|
memcpy (link, "./", 2);
|
||||||
|
strcpy (link + 2, linkfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Construct LINK as explained above. */
|
/* Construct LINK as explained above. */
|
||||||
link = xmalloc (3 * basedirs + strlen (linkfile) + 1);
|
link = xmalloc (3 * basedirs + strlen (linkfile) + 1);
|
||||||
for (i = 0; i < basedirs; i++)
|
for (i = 0; i < basedirs; i++)
|
||||||
memcpy (link + 3 * i, "../", 3);
|
memcpy (link + 3 * i, "../", 3);
|
||||||
strcpy (link + 3 * i, linkfile);
|
strcpy (link + 3 * i, linkfile);
|
||||||
|
}
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ my $converted = <<EOF;
|
|||||||
<title>Index</title>
|
<title>Index</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a href="site%3Bsub:.html">Site</a>
|
<a href="./site%3Bsub:.html">Site</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user