mirror of
https://git.sr.ht/~sircmpwn/gmnisrv
synced 2024-11-03 06:07:17 -05:00
add a missing "/" to autoindex paths
With the following directory structure: /srv/gmni: baz/ foo/ /srv/gmni/baz: a /srv/gmni/foo: bar/ /srv/gmni/foo/bar: b trying to access gemini://somesite/ with autoindex=on works, but accessing /foo fails because it tries to stat /srv/gmni/foobar instead of /srv/gmni/foo/bar. This commit fixes that by adding a trailing slash.
This commit is contained in:
parent
e77f354ca3
commit
a22bec5149
@ -56,8 +56,7 @@ serve_autoindex(struct gmnisrv_client *client, const char *path)
|
||||
errno = 0;
|
||||
while ((ent = readdir(dirp)) != NULL) {
|
||||
char fpath[PATH_MAX + 1];
|
||||
strcpy(fpath, path);
|
||||
strncat(fpath, ent->d_name, sizeof(fpath)-1);
|
||||
snprintf(fpath, sizeof(fpath), "%s/%s", path, ent->d_name);
|
||||
|
||||
struct stat st;
|
||||
if (stat(fpath, &st) != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user