aboutsummaryrefslogtreecommitdiff
path: root/wiki.c
diff options
context:
space:
mode:
authorthe little girl <yui@blekksprut.net>2014-01-09 21:12:12 +0100
committerthe little girl <yui@blekksprut.net>2014-01-09 21:12:12 +0100
commitabfb23091bd2306c87ebdc8ac31e1d72329d668e (patch)
tree0bac9300652f67ba9ae49721fa91837ae3ac4696 /wiki.c
parentad648f235d7643ff78c6eaaf9291ce5c96ac99ae (diff)
downloadukulele-abfb23091bd2306c87ebdc8ac31e1d72329d668e.tar.xz
loft -> .loft
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);