mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
HTML-escape dirname in href (not perfect, good enough).
This commit is contained in:
parent
ca12585a0e
commit
02c211d47c
@ -1,6 +1,6 @@
|
|||||||
2008-11-12 Micah Cowan <micah@cowan.name>
|
2008-11-12 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
* ftp-ls.c (ftp_index): HTML-escape dir name in title, h1.
|
* ftp-ls.c (ftp_index): HTML-escape dir name in title, h1, a:href.
|
||||||
|
|
||||||
2008-11-12 Alexander Belopolsky <alexander.belopolsky@gmail.com>
|
2008-11-12 Alexander Belopolsky <alexander.belopolsky@gmail.com>
|
||||||
|
|
||||||
|
@ -890,7 +890,6 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
|
|||||||
fprintf (fp, _("Index of /%s on %s:%d"), htcldir, u->host, u->port);
|
fprintf (fp, _("Index of /%s on %s:%d"), htcldir, u->host, u->port);
|
||||||
fprintf (fp, "</h1>\n<hr>\n<pre>\n");
|
fprintf (fp, "</h1>\n<hr>\n<pre>\n");
|
||||||
|
|
||||||
xfree (htcldir);
|
|
||||||
while (f)
|
while (f)
|
||||||
{
|
{
|
||||||
fprintf (fp, " ");
|
fprintf (fp, " ");
|
||||||
@ -934,7 +933,11 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
|
|||||||
fprintf (fp, "<a href=\"ftp://%s%s:%d", upwd, u->host, u->port);
|
fprintf (fp, "<a href=\"ftp://%s%s:%d", upwd, u->host, u->port);
|
||||||
if (*u->dir != '/')
|
if (*u->dir != '/')
|
||||||
putc ('/', fp);
|
putc ('/', fp);
|
||||||
fprintf (fp, "%s", u->dir);
|
/* XXX: Should probably URL-escape dir components here, rather
|
||||||
|
* than just HTML-escape, for consistency with the next bit where
|
||||||
|
* we use urlclfile for the file component. Anyway, this is safer
|
||||||
|
* than what we had... */
|
||||||
|
fprintf (fp, "%s", htcldir);
|
||||||
if (*u->dir)
|
if (*u->dir)
|
||||||
putc ('/', fp);
|
putc ('/', fp);
|
||||||
fprintf (fp, "%s", urlclfile);
|
fprintf (fp, "%s", urlclfile);
|
||||||
@ -954,6 +957,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
|
|||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
fprintf (fp, "</pre>\n</body>\n</html>\n");
|
fprintf (fp, "</pre>\n</body>\n</html>\n");
|
||||||
|
xfree (htcldir);
|
||||||
xfree (upwd);
|
xfree (upwd);
|
||||||
if (!output_stream)
|
if (!output_stream)
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user