mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-17 05:42:31 -04:00
Videos: Fix empty response when rv published field is nonexistent (#5162)
Fixes #5161 by checking recommended videos published field for presence before attempting to parse it in api
This commit is contained in:
commit
6ac74f4362
1 changed files with 1 additions and 1 deletions
|
@ -268,7 +268,7 @@ module Invidious::JSONify::APIv1
|
||||||
json.field "viewCountText", rv["short_view_count"]?
|
json.field "viewCountText", rv["short_view_count"]?
|
||||||
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
|
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
|
||||||
json.field "published", rv["published"]?
|
json.field "published", rv["published"]?
|
||||||
if !rv["published"]?.nil?
|
if rv["published"]?.try &.presence
|
||||||
json.field "publishedText", translate(locale, "`x` ago", recode_date(Time.parse_rfc3339(rv["published"].to_s), locale))
|
json.field "publishedText", translate(locale, "`x` ago", recode_date(Time.parse_rfc3339(rv["published"].to_s), locale))
|
||||||
else
|
else
|
||||||
json.field "publishedText", ""
|
json.field "publishedText", ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue