mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-27 23:18:35 +00:00
Reduce indent in StaticAssetsHandler#serve_file
This commit is contained in:
parent
c012206f80
commit
a49bfa75a7
@ -50,9 +50,13 @@ module Invidious::HttpServer
|
||||
|
||||
range_header = context.request.headers["Range"]?
|
||||
|
||||
if !file_info.is_a? CachedFile
|
||||
retrieve_bytes_from = IO::Memory.new
|
||||
# If the file is cached we can just directly serve it
|
||||
if file_info.is_a? CachedFile
|
||||
return dispatch_serve(context, file_info.data, file_info, range_header)
|
||||
end
|
||||
|
||||
# Otherwise we'll need to read from disk and cache it
|
||||
retrieve_bytes_from = IO::Memory.new
|
||||
File.open(file_path) do |file|
|
||||
# We cannot cache partial data so we'll rewind and read from the start
|
||||
if range_header
|
||||
@ -65,9 +69,6 @@ module Invidious::HttpServer
|
||||
end
|
||||
|
||||
return flush_io_to_cache(retrieve_bytes_from, file_path, file_info)
|
||||
else
|
||||
return dispatch_serve(context, file_info.data, file_info, range_header)
|
||||
end
|
||||
end
|
||||
|
||||
# Writes file data to the cache
|
||||
|
Loading…
Reference in New Issue
Block a user