]> sjero.net Git - wget/commitdiff
HTML-escape dir name in title, h1.
authorMicah Cowan <micah@cowan.name>
Thu, 13 Nov 2008 05:00:05 +0000 (21:00 -0800)
committerMicah Cowan <micah@cowan.name>
Thu, 13 Nov 2008 05:00:05 +0000 (21:00 -0800)
src/ChangeLog
src/ftp-ls.c

index da701d6c0a88bf45ec782046203bded608022605..1d09c9335d787d47087bbc0651e26af690b020e2 100644 (file)
@@ -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.
index dd6caa661273b1fb422d0fd6157d9a06ea5feab7..d996b8adda9154096eb564050d434a6fca68e5d5 100644 (file)
@@ -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, "  ");