diff --git a/src/ChangeLog b/src/ChangeLog index da701d6c..1d09c933 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-11-12 Micah Cowan <micah@cowan.name> + + * ftp-ls.c (ftp_index): HTML-escape dir name in title, h1. + 2008-11-12 Alexander Belopolsky <alexander.belopolsky@gmail.com> * url.c, url.h (url_escape_unsafe_and_reserved): Added. diff --git a/src/ftp-ls.c b/src/ftp-ls.c index dd6caa66..d996b8ad 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -850,6 +850,7 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f) { FILE *fp; char *upwd; + char *htcldir; /* HTML-clean dir name */ char *htclfile; /* HTML-clean file name */ char *urlclfile; /* URL-clean file name */ @@ -879,12 +880,17 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f) } else upwd = xstrdup (""); + + htcldir = html_quote_string (u->dir); + fprintf (fp, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"); fprintf (fp, "<html>\n<head>\n<title>"); - fprintf (fp, _("Index of /%s on %s:%d"), u->dir, u->host, u->port); + fprintf (fp, _("Index of /%s on %s:%d"), htcldir, u->host, u->port); fprintf (fp, "</title>\n</head>\n<body>\n<h1>"); - fprintf (fp, _("Index of /%s on %s:%d"), u->dir, 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"); + + xfree (htcldir); while (f) { fprintf (fp, " ");