Skip to content

Commit

Permalink
Merge pull request #37 from cloudinary/v2.9.2
Browse files Browse the repository at this point in the history
V2.9.2
  • Loading branch information
Pini authored Dec 19, 2018
2 parents 2ead0e2 + 03275fd commit a8ed585
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use CloudinaryExtension\CredentialValidator;
use CloudinaryExtension\Security\CloudinaryEnvironmentVariable;
use CloudinaryExtension\AutoUploadMapping\RequestProcessor;
use CloudinaryExtension\AutoUploadMapping\Configuration;
use CloudinaryExtension\AutoUploadMapping\ApiClient;

class Cloudinary_Cloudinary_Model_Observer_Config extends Mage_Core_Model_Abstract
Expand Down Expand Up @@ -45,7 +46,7 @@ public function cloudinaryConfigChanged(Varien_Event_Observer $observer)
return;
}

if (!$this->autoUploadRequestProcessor()->handle('media', Mage::getBaseUrl('media'))) {
if (!$this->autoUploadRequestProcessor()->handle('media', Mage::getBaseUrl('media'), true)) {
Mage::getSingleton('adminhtml/session')->addError(self::AUTO_UPLOAD_SETUP_FAIL_MESSAGE);
Mage::getModel('cloudinary_cloudinary/logger')->error(self::AUTO_UPLOAD_SETUP_FAIL_MESSAGE);
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Cloudinary/Cloudinary/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Cloudinary_Cloudinary>
<version>2.9.1</version>
<version>2.9.2</version>
</Cloudinary_Cloudinary>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public function __construct(
/**
* @param string $folder
* @param string $url
* @param bool $force
* @return bool
*/
public function handle($folder, $url)
public function handle($folder, $url, $force = false)
{
if ($this->configuration->isActive() == $this->configuration->getRequestState()) {
if ($this->configuration->isActive() == $this->configuration->getRequestState() && !$force) {
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/CloudinaryExtension/CloudinaryImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public function retrieveTransformed(Image $image, Transformation $transformation
]);

if ($this->configuration->getUseRootPath()) {
if (strpos($imagePath, ".com/{$this->configuration->getCloud()}/image/upload/") !== false) {
$imagePath = str_replace(".com/{$this->configuration->getCloud()}/image/upload/", ".com/{$this->configuration->getCloud()}/", $imagePath);
} elseif (strpos($imagePath, ".com/image/upload/") !== false) {
$imagePath = str_replace(".com/image/upload/", ".com/", $imagePath);
if (strpos($imagePath, "cloudinary.com/{$this->configuration->getCloud()}/image/upload/") !== false) {
$imagePath = str_replace("cloudinary.com/{$this->configuration->getCloud()}/image/upload/", "cloudinary.com/{$this->configuration->getCloud()}/", $imagePath);
} elseif (strpos($imagePath, "cloudinary.com/image/upload/") !== false) {
$imagePath = str_replace("cloudinary.com/image/upload/", "cloudinary.com/", $imagePath);
}
}
if ($this->configuration->getRemoveVersionNumber()) {
Expand Down

0 comments on commit a8ed585

Please sign in to comment.