Prevent missing file extensions from throwing errors#5947
Prevent missing file extensions from throwing errors#5947lipemat wants to merge 1 commit intowp-cli:mainfrom lipemat:fix/gracefully-handle-missing-extension
Conversation
Some file URL do not include the common .zip extension and therefore are missing their extension when reaching the `import` method of `FileCache`. This issue is commonly seen with Premium plugins which use a custom URL to provide access to a keyed download file. Running `wp plugin update <name of premium plugin>` was throwing a "Warning: copy(-<version>.): Failed to open stream: Permission denied". Instead of assuming the extension is valid nor trying to guess the extension is `.zip` simply bypass the storing of cache when the extension is not available.
|
I'm not familiar with this code myself, so bear with me. Here's a passing test for
I suspect your sample data looks something like
It's possible for a server to serve So what should a failing test look like with the current code? Would you please add I think your solution of "never worry about caching files whose type is ambiguous" is fine, but I'd like to write an accurate test for it.
|
|
Here is the error you requested: Error: FileCache::import( 'plugin/advanced-sidebar-menu-pro-9.5.7.', 'C:\Users\box\AppData\Local\Temp/664e5754330ad-TsJObX.tmp' ) |
|
Thanks. I'm on MacOS and that doesn't cause a failing test for me. But Microsoft says:
So when I think the fix is to use Will you manually test that please? |
|
That seems to work with |
|
Closing in favour of #5951. Thank you. |
Some file URL do not include the common .zip extension and therefore are missing their extension when reaching the
importmethod ofFileCache.This issue is commonly seen with Premium plugins which use a custom URL to provide access to a keyed download file.
Running
wp plugin update <name of premium plugin>was throwing a "Warning: copy(-.): Failed to open stream: Permission denied".Instead of assuming the extension is valid nor trying to guess the extension is
.zipsimply bypass the storing of cache when the extension is not available.