Skip to content

Commit

Permalink
Fix HLS poster extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
mbklein committed Sep 6, 2024
1 parent a2faab7 commit 9561d09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/master_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,12 @@ def find_frame_source(options={})
secure_url = SecurityHandler.secure_url(playlist_url, target: self.id)
playlist = Avalon::M3U8Reader.read(secure_url)
details = playlist.at(options[:offset])
details[:location] = SecurityHandler.secure_url(details[:location])
details[:location] = SecurityHandler.secure_url(Addressable::URI.unescape(details[:location]))

# Fixes https://github.com/avalonmediasystem/avalon/issues/3474
target_location = File.basename(details[:location]).split('?')[0]
target = File.join(Dir.tmpdir, target_location)
File.open(target,'wb') { |f| open(details[:location]) { |io| f.write(io.read) } }
File.open(target,'wb') { |f| URI.open(details[:location]) { |io| f.write(io.read) } }
response = { source: target, offset: details[:offset], master: false }
end
end
Expand Down

0 comments on commit 9561d09

Please sign in to comment.