From abfb23091bd2306c87ebdc8ac31e1d72329d668e Mon Sep 17 00:00:00 2001 From: the little girl Date: Thu, 9 Jan 2014 21:12:12 +0100 Subject: loft -> .loft --- wiki.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wiki.c b/wiki.c index 843278b..d788e91 100644 --- a/wiki.c +++ b/wiki.c @@ -120,8 +120,12 @@ int edit(char *path) { return 0; } -char *loft = "loft"; -int store(char *id, char *data, int len) { +char *loft = ".loft"; +int store(char *raw, char *data, int len) { + char *dir = dirname(strdup(raw)); + char *id = basename(strdup(raw)); + if(chdir(dir)) + return problem(404, "Not found"); char path[strlen(id) + strlen(loft) + 256]; time_t epoch = time(NULL); snprintf(path, 512, "%s/%s.%d", loft, id, epoch); -- cgit v1.0