diff options
| author | matthewmcgarvey <matthewmcgarvey14@gmail.com> | 2022-01-25 19:28:16 -0600 |
|---|---|---|
| committer | matthewmcgarvey <matthewmcgarvey14@gmail.com> | 2022-01-25 19:28:16 -0600 |
| commit | df9f897ebeb6db5779f3f489645be759c9ed9760 (patch) | |
| tree | 6fbf58eb80a0ef711b75dd101fcc3300e25f8fa1 /src | |
| parent | 8ef1e81294a3426009e705a61a69ef91e1e8f7c2 (diff) | |
| download | invidious-df9f897ebeb6db5779f3f489645be759c9ed9760.tar.gz invidious-df9f897ebeb6db5779f3f489645be759c9ed9760.tar.bz2 invidious-df9f897ebeb6db5779f3f489645be759c9ed9760.zip | |
Fix code broken when extracting data control route
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/routes/preferences.cr | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index f7bc5a07..faae03bc 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -316,7 +316,7 @@ module Invidious::Routes::PreferencesRoute body = part.body.gets_to_end type = part.headers["Content-Type"] - return if body.empty? + next if body.empty? # TODO: Unify into single import based on content-type case part.name @@ -349,9 +349,9 @@ module Invidious::Routes::PreferencesRoute description = item["description"]?.try &.as_s?.try &.delete("\r") privacy = item["privacy"]?.try &.as_s?.try { |privacy| PlaylistPrivacy.parse? privacy } - return if !title - return if !description - return if !privacy + next if !title + next if !description + next if !privacy playlist = create_playlist(title, privacy, user) Invidious::Database::Playlists.update_description(playlist.id, description) @@ -360,12 +360,12 @@ module Invidious::Routes::PreferencesRoute raise InfoException.new("Playlist cannot have more than 500 videos") if idx > 500 video_id = video_id.try &.as_s? - return if !video_id + next if !video_id begin video = get_video(video_id) rescue ex - return + next end playlist_video = PlaylistVideo.new({ @@ -425,12 +425,12 @@ module Invidious::Routes::PreferencesRoute body = JSON.parse(body) user.subscriptions += body["subscriptions"].as_a.compact_map do |channel| if match = channel["url"].as_s.match(/\/channel\/(?<channel>UC[a-zA-Z0-9_-]{22})/) - return match["channel"] + next match["channel"] elsif match = channel["url"].as_s.match(/\/user\/(?<user>.+)/) response = YT_POOL.client &.get("/user/#{match["user"]}?disable_polymer=1&hl=en&gl=US") html = XML.parse_html(response.body) ucid = html.xpath_node(%q(//link[@rel="canonical"])).try &.["href"].split("/")[-1] - return ucid if ucid + next ucid if ucid end nil |
