-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace underlying rwcarlsen/goexif with dsoprea/go-exif #8606
Conversation
Couple of questions:
if err != nil {
return
}
|
d4e8aef
to
9317825
Compare
if err != nil {
return err
} A common pattern to make the above a little more compact is to do: if val, err := foo(); err != nil {
return err
} As in, I almost never used named return values (or whatever they're called).
|
9317825
to
0c296e9
Compare
@bep Made a few changes. Fixed the build issue when file has no Exif data. Also, added type assertions & type-based test cases for tag values. |
|
||
func processRational(n int64, d int64) interface{} { | ||
rat := big.NewRat(n, d) | ||
if n != 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bep This logic existed in the previous code, making the value of rational exif tags either float64
or big.Rat
type depending on the numerator. Have copied the logic as such and added corresponding tests; however, let me know if returning just one of the types (float64
or big.Rat
) all the time makes more sense.
Hey, It still fails for me in the case of an image with no Exif. What I suggest is that you make: Decode(r io.Reader) (ex *Exif, err error) Into Decode(r io.Reader) (*Exif, error) And remove the panic recovery at the top. And then you need to explicitly handle all errors, including The above also suggests that we miss out on a test case for a JPG without Exif metadata ... |
0c296e9
to
728a34f
Compare
Hi @bep I've added a new test case by stripping hugo/resources/images/exif/exif_test.go Line 65 in fcd63de
Hope it doesn't look clumsy. |
Hi @bep, were you able to look into this? |
Replace underlying EXIF library (rwcarlsen/goexif) with an actively developed one(dsoprea/go-exif). Add tests for disable options (date & location) while decoding EXIF. Fixes gohugoio#8586
728a34f
to
8fa7ece
Compare
@danedavid looking at it now ... |
This works great now; I'm going to rebase and merge this in #8761 -- thanks! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #8586