-
-
Notifications
You must be signed in to change notification settings - Fork 888
Add overloads. Fix #1144 #1146
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
Add overloads. Fix #1144 #1146
Conversation
src/ImageSharp/Image.FromFile.cs
Outdated
| /// </returns> | ||
| public static IImageInfo Identify(Configuration config, string filePath, out IImageFormat format) | ||
| { | ||
| config ??= Configuration.Default; |
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.
Wouldn't it be better to guard against null on places like this? A call in a form of Image.Identify(null, "blah", out blah) is not something I would encourage.
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.
I was following the existing pattern but you're right. I've updated the code to use null checks throughout. Turns out we were passing null in some instances internally!
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.
Shouldn't we consider changing it? Maybe as part of #1110?
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.
See above edit.
Codecov Report
@@ Coverage Diff @@
## master #1146 +/- ##
==========================================
+ Coverage 82.26% 82.27% +0.01%
==========================================
Files 679 679
Lines 29256 29274 +18
Branches 3281 3278 -3
==========================================
+ Hits 24067 24085 +18
- Misses 4498 4500 +2
+ Partials 691 689 -2
Continue to review full report at Codecov.
|
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.
LGTM
Prerequisites
Description
Adds additional overloads to
Image.Identifyto handle both file paths and byte arrays.