mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-26 16:52:12 +05:30
Use a find instead of an each loop
This commit is contained in:
parent
6b0e4e6817
commit
bba1769f4b
@ -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