mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Use a find instead of an each loop
This commit is contained in:
parent
123c4dfba5
commit
77de46f316
@ -291,10 +291,9 @@ struct Invidious::User
|
|||||||
|
|
||||||
def from_newpipe(user : User, body : String) : Bool
|
def from_newpipe(user : User, body : String) : Bool
|
||||||
Compress::Zip::File.open(IO::Memory.new(body), true) do |file|
|
Compress::Zip::File.open(IO::Memory.new(body), true) do |file|
|
||||||
file.entries.each do |entry|
|
entry = file.entries.find { |file_entry| file_entry.filename == "newpipe.db" }
|
||||||
|
return false if entry.nil?
|
||||||
entry.open do |file_io|
|
entry.open do |file_io|
|
||||||
next if entry.filename != "newpipe.db"
|
|
||||||
|
|
||||||
# Ensure max size of 4MB
|
# Ensure max size of 4MB
|
||||||
io_sized = IO::Sized.new(file_io, 0x400000)
|
io_sized = IO::Sized.new(file_io, 0x400000)
|
||||||
|
|
||||||
@ -327,7 +326,6 @@ struct Invidious::User
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Success!
|
# Success!
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user