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
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);
|
char *id = xs_list_get(l, 1);
|
||||||
int sz;
|
int sz;
|
||||||
|
|
||||||
|
if (id && *id) {
|
||||||
status = static_get(&snac, id, body, &sz,
|
status = static_get(&snac, id, body, &sz,
|
||||||
xs_dict_get(req, "if-none-match"), etag);
|
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);
|
*ctype = xs_mime_by_ext(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (xs_startswith(p_path, "h/")) { /** an entry from the history **/
|
if (xs_startswith(p_path, "h/")) { /** an entry from the history **/
|
||||||
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 (id && *id) {
|
||||||
if (xs_endswith(id, "timeline.html_")) {
|
if (xs_endswith(id, "timeline.html_")) {
|
||||||
// Don't let them in.
|
/* Don't let them in */
|
||||||
*b_size = 0;
|
*b_size = 0;
|
||||||
status = 404;
|
status = 404;
|
||||||
} else if ((*body = history_get(&snac, id)) != NULL) {
|
}
|
||||||
|
else
|
||||||
|
if ((*body = history_get(&snac, id)) != NULL) {
|
||||||
*b_size = strlen(*body);
|
*b_size = strlen(*body);
|
||||||
status = 200;
|
status = 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(p_path, ".rss") == 0) { /** public timeline in RSS format **/
|
if (strcmp(p_path, ".rss") == 0) { /** public timeline in RSS format **/
|
||||||
d_char *rss;
|
d_char *rss;
|
||||||
|
|
Loading…
Reference in a new issue