format_parser 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2bd20132739f75daaae94963ac56837e4852af4bd891d0b74abfef85e110eae
4
- data.tar.gz: 442e4d4a2cdbe5c5fa1fd46b12e218f33c1e52d4706d94d751800a12913aa6ae
3
+ metadata.gz: b3c1744492b66a28cf9ff258a894c28f74552eb560794e74bb2ab9c06801f0be
4
+ data.tar.gz: 7f92fb35cd4b18992879b6a37799c479452f83f67e5535bc92711a26af0bcc02
5
5
  SHA512:
6
- metadata.gz: b51a7884bb770ec2bc4d49c7583d9215acf162258368ab557d2da2475083d9ba85e7c00c34506f8cc01c812051189b3cc3e30aaea8c919bc0b7166f255947b96
7
- data.tar.gz: ba4a3377d265d6f9d1a5887bd6de7cdc83a92c39dbfcb04c97182be265514ffc3b2d36bad1938dc0385d264602fbd197c5e8c7321cc7ad097ddb2303a612d022
6
+ metadata.gz: b45536df47aaf92fd28c4d32bc5ce67bf66cda6d1079f1212e4a7f21fa90b998938adb0e619251a30a65637e04f6de372a6bb545cc856bd7f3fcf36a82a87caa
7
+ data.tar.gz: f7604ed45d27c6316d2dcf78df2dae6ec6bebe405cc20639e0b5364f1c0018c4b3f9e621ebeb93d198f8472f293f436a40958312e1d2d1c9b0cdb8530a05b159
@@ -1,3 +1,6 @@
1
+ ## 0.13.1
2
+ * Avoid ZIP checks in the JPEG parser which are no longer necessary
3
+
1
4
  ## 0.13.0
2
5
  * Replace the homegrown ID3 parser with [id3tag](https://github.com/krists/id3tag) - this introduces id3tag
3
6
  as a dependency in addition to `exifr`, but the gains are substantial.
@@ -1,3 +1,3 @@
1
1
  module FormatParser
2
- VERSION = '0.13.0'
2
+ VERSION = '0.13.1'
3
3
  end
@@ -42,12 +42,6 @@ class FormatParser::JPEGParser
42
42
 
43
43
  markers_start_at = @buf.pos
44
44
 
45
- # Keynote files start with a series of _perfectly_ valid
46
- # JPEG markers, probably for icon previews or QuickLook.
47
- # We have to detect those and reject them earlier. We can
48
- # make use of our magic ZIP reader to get there.
49
- return if probably_keynote_zip?
50
-
51
45
  @buf.seek(markers_start_at)
52
46
 
53
47
  while marker = read_next_marker
@@ -165,10 +159,5 @@ class FormatParser::JPEGParser
165
159
  safe_skip(@buf, length)
166
160
  end
167
161
 
168
- def probably_keynote_zip?
169
- reader = FormatParser::ZIPParser::FileReader.new
170
- reader.zip?(@buf)
171
- end
172
-
173
162
  FormatParser.register_parser self, natures: :image, formats: :jpg
174
163
  end
@@ -195,25 +195,6 @@ class FormatParser::ZIPParser::FileReader
195
195
  entries
196
196
  end
197
197
 
198
- # Tells whether the given IO is likely to be a ZIP file without
199
- # performing too many detailed reads
200
- #
201
- # @param io[#tell, #seek, #read, #size] an IO-ish object
202
- # @return [Boolean]
203
- def zip?(io)
204
- zip_file_size = io.size
205
- eocd_offset = get_eocd_offset(io, zip_file_size)
206
- zip64_end_of_cdir_location = get_zip64_eocd_location(io, eocd_offset)
207
- if zip64_end_of_cdir_location
208
- num_files_and_central_directory_offset_zip64(io, zip64_end_of_cdir_location)
209
- else
210
- num_files_and_central_directory_offset(io, eocd_offset)
211
- end
212
- true
213
- rescue Error
214
- false
215
- end
216
-
217
198
  private
218
199
 
219
200
  def skip_ahead_2(io)
@@ -98,18 +98,4 @@ describe FormatParser::ZIPParser do
98
98
  expect(first_entry.filename).to eq('Li��nia Extreme//')
99
99
  expect(first_entry.type).to eq(:directory)
100
100
  end
101
-
102
- describe 'FileReader#zip?' do
103
- it 'correctly detects all the ZIP files as such' do
104
- reader = described_class::FileReader.new
105
- Dir.glob(fixtures_dir + '/ZIP/*.zip').each do |path|
106
- expect(reader).to be_zip(File.open(path, 'rb'))
107
- end
108
-
109
- 4.times do
110
- blob = Random.new.bytes(1024)
111
- expect(reader).not_to be_zip(StringIO.new(blob))
112
- end
113
- end
114
- end
115
101
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: format_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Berman