Skip to content

[Backport] Issue#20277 fixed for 2.3.x #20748

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

namespace Magento\Sales\Controller\Download;

use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\Action\Context;
use Magento\Catalog\Model\Product\Type\AbstractType;
use Magento\Framework\Controller\Result\ForwardFactory;

/**
* Class DownloadCustomOption
*
* @package Magento\Sales\Controller\Download
*/
class DownloadCustomOption extends \Magento\Framework\App\Action\Action
class DownloadCustomOption extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface
{
/**
* @var ForwardFactory
Expand Down Expand Up @@ -95,10 +97,11 @@ public function execute()
/** @var $productOption \Magento\Catalog\Model\Product\Option */
$productOption = $this->_objectManager->create(
\Magento\Catalog\Model\Product\Option::class
)->load($optionId);
);
$productOption->load($optionId);
}

if (!$productOption || !$productOption->getId() || $productOption->getType() != 'file') {
if ($productOption->getId() && $productOption->getType() != 'file') {
return $resultForward->forward('noroute');
}

Expand Down