Skip to content

Commit df9f897

Browse files
Fix code broken when extracting data control route
1 parent 8ef1e81 commit df9f897

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/invidious/routes/preferences.cr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ module Invidious::Routes::PreferencesRoute
316316
body = part.body.gets_to_end
317317
type = part.headers["Content-Type"]
318318

319-
return if body.empty?
319+
next if body.empty?
320320

321321
# TODO: Unify into single import based on content-type
322322
case part.name
@@ -349,9 +349,9 @@ module Invidious::Routes::PreferencesRoute
349349
description = item["description"]?.try &.as_s?.try &.delete("\r")
350350
privacy = item["privacy"]?.try &.as_s?.try { |privacy| PlaylistPrivacy.parse? privacy }
351351

352-
return if !title
353-
return if !description
354-
return if !privacy
352+
next if !title
353+
next if !description
354+
next if !privacy
355355

356356
playlist = create_playlist(title, privacy, user)
357357
Invidious::Database::Playlists.update_description(playlist.id, description)
@@ -360,12 +360,12 @@ module Invidious::Routes::PreferencesRoute
360360
raise InfoException.new("Playlist cannot have more than 500 videos") if idx > 500
361361

362362
video_id = video_id.try &.as_s?
363-
return if !video_id
363+
next if !video_id
364364

365365
begin
366366
video = get_video(video_id)
367367
rescue ex
368-
return
368+
next
369369
end
370370

371371
playlist_video = PlaylistVideo.new({
@@ -425,12 +425,12 @@ module Invidious::Routes::PreferencesRoute
425425
body = JSON.parse(body)
426426
user.subscriptions += body["subscriptions"].as_a.compact_map do |channel|
427427
if match = channel["url"].as_s.match(/\/channel\/(?<channel>UC[a-zA-Z0-9_-]{22})/)
428-
return match["channel"]
428+
next match["channel"]
429429
elsif match = channel["url"].as_s.match(/\/user\/(?<user>.+)/)
430430
response = YT_POOL.client &.get("/user/#{match["user"]}?disable_polymer=1&hl=en&gl=US")
431431
html = XML.parse_html(response.body)
432432
ucid = html.xpath_node(%q(//link[@rel="canonical"])).try &.["href"].split("/")[-1]
433-
return ucid if ucid
433+
next ucid if ucid
434434
end
435435

436436
nil

0 commit comments

Comments
 (0)