diff --git a/lib/ffmpeg/movie.rb b/lib/ffmpeg/movie.rb index 0e148bb3..78943f27 100644 --- a/lib/ffmpeg/movie.rb +++ b/lib/ffmpeg/movie.rb @@ -148,7 +148,7 @@ def valid? end def remote? - @path =~ URI::regexp(%w(http https)) + @path&.start_with?(%r{http(s?)://}) end def local? diff --git a/spec/ffmpeg/movie_spec.rb b/spec/ffmpeg/movie_spec.rb index 2e994fc2..23f2213c 100644 --- a/spec/ffmpeg/movie_spec.rb +++ b/spec/ffmpeg/movie_spec.rb @@ -28,6 +28,12 @@ module FFMPEG end end + context "given a file containing http in the name" do + it 'should see local files with http in their name as local' do + expect(Movie.new("#{fixture_path}/movies/file_with_http_in_name.flv").remote?).to be false + end + end + context "given a URL" do before(:context) { start_web_server } after(:context) { stop_web_server } diff --git a/spec/fixtures/movies/file_with_http_in_name.flv b/spec/fixtures/movies/file_with_http_in_name.flv new file mode 100644 index 00000000..543211f2 Binary files /dev/null and b/spec/fixtures/movies/file_with_http_in_name.flv differ