-
-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9 +/- ##
============================================
- Coverage 100% 99.03% -0.97%
- Complexity 123 132 +9
============================================
Files 4 4
Lines 289 312 +23
============================================
+ Hits 289 309 +20
- Misses 0 3 +3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #9 +/- ##
============================================
- Coverage 100% 99.03% -0.97%
- Complexity 123 132 +9
============================================
Files 4 4
Lines 289 312 +23
============================================
+ Hits 289 309 +20
- Misses 0 3 +3
Continue to review full report at Codecov.
|
As stated in userfrosting/UserFrosting#965, I think this repo should also support a whitelist for future use. I'm not sure on setting up the blacklist on the Plus style issues and Codecoverage issue will need to be fixed before merging. |
I've gone through those proposed changes and thought about it for a while. First, using a blacklist might not be the best option compared to a whitelist. Let's say you only want to return images. Then you have to blacklist all other extensions except jpg and png, otherwise you'll end up with a Next, it would be more logical to have the whitelisted extension on the stream level. This cause a problem here as you need the stream object, and all we have is In the end, I don't think the extension whitelist feature is that important for URI to have. Filtering the result from URI can be done afterward, like it was done here. Furthermore, Some context might need more complex filtering, for example by mimeType or size. The typo fix were manually merged into |
Thanks @lcharette for your thorough review! I'm inclined to agree with you. |
Key changes
Summary
Each scheme can blacklist file extensions in a fairly simple way:
$locator->addBlacklistedExtension($scheme, $extension)
where
$scheme
is a string representing the scheme and$extension
is a string representing a file type (case-insensitive) (do not include the leading dot).Additionally, blacklist items can be removed with:
$locator->removeBlacklistedExtension($scheme, $extension)
And a set of blacklisted extensions per scheme can be retrieved with:
$locator->getBlacklistedExtensions($scheme)
Unit tests have been added for the new methods and all tests are passing.