janfri / mini_exiftool

This library is a wrapper for the Exiftool command-line application (https://exiftool.org) written by Phil Harvey. It provides the full power of Exiftool to Ruby: reading and writing of EXIF-data, IPTC-data and XMP-data. Branch master is for actual development and branch compatibility-version is for compatibility with Ruby 1.8 and exiftool versions prior 7.65.
GNU Lesser General Public License v2.1
213 stars 52 forks source link

US postal codes are parsed to integers instead of strings #40

Closed jvradelis closed 3 years ago

jvradelis commented 3 years ago

US postal codes beginning with a 0 and containing another zero are converted to integers and drop the initial 0.

For example, a postal code like '02109' (Boston MA) will become 2109.

I believe that line 464 of mini_exiftool.rb (convert_after_load) is intended to preserve postal codes as strings, but the match condition (when /^0+[1-9]+$/) does not handle this example properly because the second zero causes the match to fail. I propose that the condition be changed to: when /^0+[0-9]+$/.

janfri commented 3 years ago

Good catch. Thank you.

Bug is fixed in mini_exiftool 2.10.1.

jvradelis commented 3 years ago

Indeed, it is. Thanks very much.