diff options
-rw-r--r-- | wiki.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); |