[hackers] [quark] in the directory listing add / as suffix to save a redirect check || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 27 Jun 2017 23:31:29 +0200 (CEST)

commit 750f8381ce68d2c2e7b600bfac2ecc6862af2e00
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jun 27 22:34:37 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Jun 27 23:31:08 2017 +0200

    in the directory listing add / as suffix to save a redirect check

diff --git a/quark.c b/quark.c
index 3358fff..578a591 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -381,8 +381,11 @@ senddir(int fd, char *name, struct request *r)
                         }
 
                         /* entry line */
- if (dprintf(fd, "<br />\n\t\t<a href=\"%s\">%s%s</a>",
- e[i]->d_name, e[i]->d_name, filetype(e[i]->d_type)) < 0) {
+ if (dprintf(fd, "<br />\n\t\t<a href=\"%s%s\">%s%s</a>",
+ e[i]->d_name,
+ e[i]->d_type & DT_DIR ? "/" : "",
+ e[i]->d_name,
+ filetype(e[i]->d_type)) < 0) {
                                 s = S_REQUEST_TIMEOUT;
                                 goto cleanup;
                         }
Received on Tue Jun 27 2017 - 23:31:29 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 27 2017 - 23:36:59 CEST