File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 2323class Save
2424{
2525 private const IMAGE_FILE_NAME_PATTERN = '#\.(jpg|jpeg|gif|png)$# i ' ;
26- private const MAX_LENGTH = 255 ;
2726
2827 /**
2928 * @var Filesystem
@@ -39,6 +38,7 @@ class Save
3938 * @var IsPathExcludedInterface
4039 */
4140 private $ isPathExcluded ;
41+ private $ maxFileLength ;
4242
4343 /**
4444 * @param Filesystem $filesystem
@@ -48,11 +48,13 @@ class Save
4848 public function __construct (
4949 Filesystem $ filesystem ,
5050 Https $ driver ,
51- IsPathExcludedInterface $ isPathExcluded
51+ IsPathExcludedInterface $ isPathExcluded ,
52+ $ maxFileLength
5253 ) {
5354 $ this ->filesystem = $ filesystem ;
5455 $ this ->driver = $ driver ;
5556 $ this ->isPathExcluded = $ isPathExcluded ;
57+ $ this ->maxFileLength = $ maxFileLength ;
5658 }
5759
5860 /**
@@ -67,10 +69,10 @@ public function __construct(
6769 */
6870 public function execute (string $ imageUrl , string $ destinationPath , bool $ allowOverwrite = false ): void
6971 {
70- $ maxFilenameLength = self :: MAX_LENGTH ;
72+ $ maxFilenameLength = $ this -> maxFileLength ;
7173
7274 if (strlen ($ destinationPath ) > $ maxFilenameLength ) {
73- throw new \LengthException (
75+ throw new \InputException (
7476 __ ('Destination Path is too long; must be %1 characters or less ' , $ maxFilenameLength )
7577 );
7678 }
Original file line number Diff line number Diff line change 3636 <type name =" Magento\AdobeStockImage\Model\Storage\Save" >
3737 <arguments >
3838 <argument name =" driver" xsi : type =" object" >Magento\Framework\Filesystem\Driver\Https</argument >
39+ <argument name =" maxFileLength" xsi : type =" number" >255</argument >
3940 </arguments >
4041 </type >
4142 <type name =" Magento\AdobeStockImage\Model\GetRelatedImages" >
You can’t perform that action at this time.
0 commit comments