mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 06:07:29 +02:00
Fail early in 'Handler_Public#generate_syndicated_feed()' on unrecognized format.
This commit is contained in:
parent
87fb1de91d
commit
8255f71c2e
@ -8,6 +8,13 @@ class Handler_Public extends Handler {
|
|||||||
int $limit, int $offset, string $search, string $view_mode = "",
|
int $limit, int $offset, string $search, string $view_mode = "",
|
||||||
string $format = 'atom', string $order = "", string $orig_guid = "", string $start_ts = ""): void {
|
string $format = 'atom', string $order = "", string $orig_guid = "", string $start_ts = ""): void {
|
||||||
|
|
||||||
|
// fail early if the requested format isn't recognized
|
||||||
|
if (!in_array($format, ['atom', 'json'])) {
|
||||||
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
|
print "Unknown format: $format.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$note_style = "background-color : #fff7d5;
|
$note_style = "background-color : #fff7d5;
|
||||||
border-width : 1px; ".
|
border-width : 1px; ".
|
||||||
"padding : 5px; border-style : dashed; border-color : #e7d796;".
|
"padding : 5px; border-style : dashed; border-color : #e7d796;".
|
||||||
@ -251,9 +258,6 @@ class Handler_Public extends Handler {
|
|||||||
header("Content-Type: application/json; charset=utf-8");
|
header("Content-Type: application/json; charset=utf-8");
|
||||||
print json_encode($feed);
|
print json_encode($feed);
|
||||||
|
|
||||||
} else {
|
|
||||||
header("Content-Type: text/plain; charset=utf-8");
|
|
||||||
print "Unknown format: $format.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user