refactor: use reverse! and uniq! to modify the array in place
Some checks failed
Build and release container directly from master / release (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.10.1, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.11.2, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.12.1, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.13.2, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (1.14.0, true) (push) Has been cancelled
Invidious CI / build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }} (nightly, false) (push) Has been cancelled
Invidious CI / build-docker (push) Has been cancelled
Invidious CI / build-docker-arm64 (push) Has been cancelled
Invidious CI / lint (push) Has been cancelled

This commit is contained in:
Fijxu 2025-01-13 11:18:26 -03:00
parent a08fafd852
commit 43aa7e7303
No known key found for this signature in database
GPG Key ID: 32C1DDF333EDA6A4
2 changed files with 2 additions and 2 deletions

View File

@ -482,7 +482,7 @@ module Invidious::Routes::API::V1::Authenticated
env.response.content_type = "text/event-stream" env.response.content_type = "text/event-stream"
raw_topics = env.params.body["topics"]? || env.params.query["topics"]? raw_topics = env.params.body["topics"]? || env.params.query["topics"]?
topics = raw_topics.try &.split(",").uniq.first(1000) topics = raw_topics.try &.split(",").uniq!.first(1000)
topics ||= [] of String topics ||= [] of String
create_notification_stream(env, topics, CONNECTION_CHANNEL) create_notification_stream(env, topics, CONNECTION_CHANNEL)

View File

@ -724,7 +724,7 @@ module YoutubeAPI
# Multiple encodings can be combined, and are listed in the order # Multiple encodings can be combined, and are listed in the order
# in which they were applied. E.g: "deflate, gzip" means that the # in which they were applied. E.g: "deflate, gzip" means that the
# content must be first "gunzipped", then "defated". # content must be first "gunzipped", then "defated".
encodings.split(',').reverse.each do |enc| encodings.split(',').reverse!.each do |enc|
case enc.strip(' ') case enc.strip(' ')
when "gzip" when "gzip"
body_io = Compress::Gzip::Reader.new(body_io, sync_close: true) body_io = Compress::Gzip::Reader.new(body_io, sync_close: true)