Skip to content

Commit

Permalink
Fix a bug where product media upload via API was not possible anymore. (
Browse files Browse the repository at this point in the history
#1302)

* bump version

* Fix _addUrlRewrite() ignoring collection store scope. (#510)

While Mage_Catalog_Model_Resource_Product_Collection::addUrlRewrite()
does respect any set storeId on the collection it's helper that does
the actual work is hard-coded to the current active store.

* Add doc comments to image related classes (#1146)

* Prevent duplicate entry when updating salesrule_coupon_usage (#1117)

* remove $timesUsed > 0 check to prevent duplicate entry

* Prevent $timesUsed from going less than 0

* Fix a bug where media upload via API are not possible anymore: #1178

* revert unwanted changes

* Update lib/Varien/Io/File.php

Co-authored-by: Flyingmana <flyingmana@googlemail.com>
Co-authored-by: Colin Mollenhour <colin@mollenhour.com>
Co-authored-by: Erik Dannenberg <ed@reshape.de>
Co-authored-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Co-authored-by: Dean Williams <me@deanwilliams.org>
Co-authored-by: sv3n <github-sr@hotmail.com>
  • Loading branch information
7 people committed Mar 11, 2021
1 parent 08d41c2 commit cfc98cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Varien/Io/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,12 @@ public function write($filename, $src, $mode=null)
*/
protected function _IsValidSource($src)
{
//Treat string that contains a null byte as invalid
if ((is_string($src) && strpos($src, chr(0)) === false) || is_resource($src)) {
// In case of a string
if (is_string($src)) {
// If its a file we check for null byte
// If it's not a valid path, file_exists() will return a falsey value, and the @ will keep it from complaining about the bad string.
return !(@file_exists($src) && strpos($src, chr(0)) !== false);
} elseif (is_resource($src)) {
return true;
}

Expand Down Expand Up @@ -533,7 +537,7 @@ protected function _isFilenameWriteable($filename)
protected function _checkSrcIsFile($src)
{
$result = false;
if (is_string($src) && is_readable($src) && is_file($src)) {
if (is_string($src) && @is_readable($src) && is_file($src)) {
$result = true;
}

Expand Down

0 comments on commit cfc98cf

Please sign in to comment.