mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Improved checks to _object_fn_by_md5().
This commit is contained in:
parent
51ef347334
commit
b331f362be
11
data.c
11
data.c
@ -546,6 +546,7 @@ xs_list *index_list_desc(const char *fn, int skip, int show)
|
||||
static xs_str *_object_fn_by_md5(const char *md5, const char *func)
|
||||
{
|
||||
xs *bfn = xs_fmt("%s/object/%c%c", srv_basedir, md5[0], md5[1]);
|
||||
xs *ret = NULL;
|
||||
int ok = 1;
|
||||
|
||||
/* an object deleted from an index; fail but don't bark */
|
||||
@ -557,14 +558,14 @@ static xs_str *_object_fn_by_md5(const char *md5, const char *func)
|
||||
ok = 0;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
if (ok) {
|
||||
mkdirx(bfn);
|
||||
else {
|
||||
xs_free(bfn);
|
||||
bfn = xs_fmt("%s/object/invalid", srv_basedir);
|
||||
ret = xs_fmt("%s/%s.json", bfn, md5);
|
||||
}
|
||||
else
|
||||
ret = xs_fmt("%s/object/invalid/invalid.json", srv_basedir);
|
||||
|
||||
return xs_fmt("%s/%s.json", bfn, md5);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user