aboutsummaryrefslogtreecommitdiff
path: root/wiki.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiki.c')
-rw-r--r--wiki.c8
1 files 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);