mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Fixed crash on empty static and history objects.
This commit is contained in:
parent
43d2e80dc5
commit
3e21aafb26
10
html.c
10
html.c
@ -1830,6 +1830,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
||||
char *id = xs_list_get(l, 1);
|
||||
int sz;
|
||||
|
||||
if (id && *id) {
|
||||
status = static_get(&snac, id, body, &sz,
|
||||
xs_dict_get(req, "if-none-match"), etag);
|
||||
|
||||
@ -1838,20 +1839,25 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
||||
*ctype = xs_mime_by_ext(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (xs_startswith(p_path, "h/")) { /** an entry from the history **/
|
||||
xs *l = xs_split(p_path, "/");
|
||||
char *id = xs_list_get(l, 1);
|
||||
|
||||
if (id && *id) {
|
||||
if (xs_endswith(id, "timeline.html_")) {
|
||||
// Don't let them in.
|
||||
/* Don't let them in */
|
||||
*b_size = 0;
|
||||
status = 404;
|
||||
} else if ((*body = history_get(&snac, id)) != NULL) {
|
||||
}
|
||||
else
|
||||
if ((*body = history_get(&snac, id)) != NULL) {
|
||||
*b_size = strlen(*body);
|
||||
status = 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strcmp(p_path, ".rss") == 0) { /** public timeline in RSS format **/
|
||||
d_char *rss;
|
||||
|
Loading…
Reference in New Issue
Block a user