diff --git a/data.c b/data.c index 525b1e9..1cb00dd 100644 --- a/data.c +++ b/data.c @@ -1034,7 +1034,7 @@ d_char *following_list(snac *snac) d_char *_muted_fn(snac *snac, char *actor) { xs *md5 = xs_md5_hex(actor, strlen(actor)); - return xs_fmt("%s/muted/%s.json", snac->basedir, md5); + return xs_fmt("%s/muted/%s", snac->basedir, md5); } diff --git a/upgrade.c b/upgrade.c index 2473803..13f3fa1 100644 --- a/upgrade.c +++ b/upgrade.c @@ -84,9 +84,22 @@ int db_upgrade(d_char **error) snac snac; if (user_open(&snac, v)) { + char *p, *v; xs *dir = xs_fmt("%s/hidden", snac.basedir); + /* create the hidden directory */ mkdir(dir, 0755); + + /* rename all muted files incorrectly named .json */ + xs *spec = xs_fmt("%s/muted/" "*.json", snac.basedir); + xs *fns = xs_glob(spec, 0, 0); + + p = fns; + while (xs_list_iter(&p, &v)) { + xs *nfn = xs_replace(v, ".json", ""); + rename(v, nfn); + } + user_free(&snac); } }