mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-10-07 00:04:52 -04:00
Set content length for local files. Fixes #77
This commit is contained in:
parent
c89f556204
commit
ab07d1fe21
@ -350,6 +350,7 @@ class FastImage
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fetch_using_file_open
|
def fetch_using_file_open
|
||||||
|
@content_length = File.size?(@uri)
|
||||||
File.open(@uri) do |s|
|
File.open(@uri) do |s|
|
||||||
fetch_using_read(s)
|
fetch_using_read(s)
|
||||||
end
|
end
|
||||||
|
@ -152,6 +152,10 @@ class FastImageTest < Test::Unit::TestCase
|
|||||||
assert_equal info[1], FastImage.size(File.join(FixturePath, fn))
|
assert_equal info[1], FastImage.size(File.join(FixturePath, fn))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_should_report_content_length_correctly_for_local_files
|
||||||
|
assert_equal 3296, FastImage.new(File.join(FixturePath, "test.bmp")).content_length
|
||||||
|
end
|
||||||
|
|
||||||
def test_should_report_type_correctly_for_ios
|
def test_should_report_type_correctly_for_ios
|
||||||
GoodFixtures.each do |fn, info|
|
GoodFixtures.each do |fn, info|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user