-
-
Notifications
You must be signed in to change notification settings - Fork 101
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 FileProviderImageProvider and WebRootImageProvider #243
Add FileProviderImageProvider and WebRootImageProvider #243
Conversation
/// Initializes a new instance of the <see cref="FileProviderImageResolver"/> class. | ||
/// </summary> | ||
/// <param name="fileInfo">The file info.</param> | ||
public FileProviderImageResolver(IFileInfo fileInfo) => this.fileInfo = fileInfo; |
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.
Should this also do a null check?
public FileProviderImageResolver(IFileInfo fileInfo) => this.fileInfo = fileInfo; | |
public FileProviderImageResolver(IFileInfo fileInfo) => this.fileInfo = fileInfo ?? throw new ArgumentNullException(nameof(fileInfo)); |
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 wouldn't bother. The default implementation is smart enough to only call this type when the IFileInfo
is not null. If someone doesn't do this with their custom code then it's up to them.
Codecov Report
@@ Coverage Diff @@
## main #243 +/- ##
===================================
- Coverage 85% 84% -1%
===================================
Files 72 75 +3
Lines 2020 2036 +16
Branches 291 294 +3
===================================
Hits 1724 1724
- Misses 212 228 +16
Partials 84 84
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Prerequisites
Description
This adds a
FileProviderImageProvider
andWebRootImageProvider
, following the pattern mentioned in umbraco/Umbraco-CMS#12185 (comment). This is basically a simplified version of PR #207, but theseIImageProvider
s are now included as additional, non-default implementations.This would allow users to easily switch from the default
PhysicalFileSystemProvider
to theWebRootImageProvider
by using: