mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Fixed muted filenames.
This commit is contained in:
parent
e121aeb948
commit
4494fc3daf
2
data.c
2
data.c
@ -1034,7 +1034,7 @@ d_char *following_list(snac *snac)
|
|||||||
d_char *_muted_fn(snac *snac, char *actor)
|
d_char *_muted_fn(snac *snac, char *actor)
|
||||||
{
|
{
|
||||||
xs *md5 = xs_md5_hex(actor, strlen(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
13
upgrade.c
13
upgrade.c
@ -84,9 +84,22 @@ int db_upgrade(d_char **error)
|
|||||||
snac snac;
|
snac snac;
|
||||||
|
|
||||||
if (user_open(&snac, v)) {
|
if (user_open(&snac, v)) {
|
||||||
|
char *p, *v;
|
||||||
xs *dir = xs_fmt("%s/hidden", snac.basedir);
|
xs *dir = xs_fmt("%s/hidden", snac.basedir);
|
||||||
|
|
||||||
|
/* create the hidden directory */
|
||||||
mkdir(dir, 0755);
|
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);
|
user_free(&snac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user