diff options
author | default <nobody@localhost> | 2024-04-22 05:46:56 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-04-22 05:46:56 +0200 |
commit | ebf6a4bd8e97e434d1502ddead4690aca3dd6d33 (patch) | |
tree | 1c0db63d7828759c3736e75a08da60a7362c65bd /data.c | |
parent | 62cc167c5f9205bf3a758a40cd7b22b9a54164be (diff) |
URLs like {srv_baseurl}/{user}/admin/p/{md5} are valid.
But only if {md5} is in the user's timeline.
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1065,14 +1065,18 @@ int timeline_touch(snac *snac) xs_str *timeline_fn_by_md5(snac *snac, const char *md5) /* get the filename of an entry by md5 from any timeline */ { - xs_str *fn = xs_fmt("%s/private/%s.json", snac->basedir, md5); + xs_str *fn = NULL; - if (mtime(fn) == 0.0) { - fn = xs_free(fn); - fn = xs_fmt("%s/public/%s.json", snac->basedir, md5); + if (xs_is_hex(md5) && strlen(md5) == 32) { + fn = xs_fmt("%s/private/%s.json", snac->basedir, md5); - if (mtime(fn) == 0.0) + if (mtime(fn) == 0.0) { fn = xs_free(fn); + fn = xs_fmt("%s/public/%s.json", snac->basedir, md5); + + if (mtime(fn) == 0.0) + fn = xs_free(fn); + } } return fn; |