From 4494fc3daf438733210ab3f20af5cd5492d60e2d Mon Sep 17 00:00:00 2001 From: default Date: Thu, 24 Nov 2022 10:06:24 +0100 Subject: [PATCH] Fixed muted filenames. --- data.c | 2 +- upgrade.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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); } }