mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Fixed crash on empty static and history objects.
This commit is contained in:
parent
43d2e80dc5
commit
3e21aafb26
1 changed files with 17 additions and 11 deletions
28
html.c
28
html.c
|
@ -1830,12 +1830,14 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
||||||
char *id = xs_list_get(l, 1);
|
char *id = xs_list_get(l, 1);
|
||||||
int sz;
|
int sz;
|
||||||
|
|
||||||
status = static_get(&snac, id, body, &sz,
|
if (id && *id) {
|
||||||
|
status = static_get(&snac, id, body, &sz,
|
||||||
xs_dict_get(req, "if-none-match"), etag);
|
xs_dict_get(req, "if-none-match"), etag);
|
||||||
|
|
||||||
if (valid_status(status)) {
|
if (valid_status(status)) {
|
||||||
*b_size = sz;
|
*b_size = sz;
|
||||||
*ctype = xs_mime_by_ext(id);
|
*ctype = xs_mime_by_ext(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1843,13 +1845,17 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
||||||
xs *l = xs_split(p_path, "/");
|
xs *l = xs_split(p_path, "/");
|
||||||
char *id = xs_list_get(l, 1);
|
char *id = xs_list_get(l, 1);
|
||||||
|
|
||||||
if (xs_endswith(id, "timeline.html_")) {
|
if (id && *id) {
|
||||||
// Don't let them in.
|
if (xs_endswith(id, "timeline.html_")) {
|
||||||
*b_size = 0;
|
/* Don't let them in */
|
||||||
status = 404;
|
*b_size = 0;
|
||||||
} else if ((*body = history_get(&snac, id)) != NULL) {
|
status = 404;
|
||||||
*b_size = strlen(*body);
|
}
|
||||||
status = 200;
|
else
|
||||||
|
if ((*body = history_get(&snac, id)) != NULL) {
|
||||||
|
*b_size = strlen(*body);
|
||||||
|
status = 200;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue