htls: Remember to quote URL characters in filenames.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 30 Aug 2010 15:30:59 +0000 (17:30 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 30 Aug 2010 15:33:39 +0000 (17:33 +0200)
src/htls.c

index 907187c..d2db5f4 100644 (file)
@@ -149,8 +149,9 @@ static void mkindex(char *name, DIR *dir, struct charbuf *dst)
        if(dirbuf.b[i].w)
            bprintf(dst, " writable");
        bprintf(dst, "\">");    
-       fn = htmlquote(dirbuf.b[i].name);
-       bprintf(dst, "<td class=\"filename\"><a href=\"%s\">%s</a></td>", fn, fn);
+       bprintf(dst, "<td class=\"filename\"><a href=\"%s\">", htmlquote(urlquote(dirbuf.b[i].name)));
+       bprintf(dst, "%s", htmlquote(dirbuf.b[i].name));
+       bprintf(dst, "</a></td>");
        if(dispsize) {
            bprintf(dst, "<td class=\"filesize\">");
            if(!S_ISDIR(dirbuf.b[i].sb.st_mode))