File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 2121 */
2222class Save
2323{
24- private const MAX_LENGTH = 255 ;
25-
2624 /**
2725 * @var Filesystem
2826 */
@@ -33,15 +31,20 @@ class Save
3331 */
3432 private $ driver ;
3533
34+ private $ maxFileLength ;
35+
3636 /**
3737 * Storage constructor.
3838 * @param Filesystem $filesystem
3939 * @param Https $driver
40+ * @param $maxFileLength
4041 */
4142 public function __construct (
4243 Filesystem $ filesystem ,
43- Https $ driver
44+ Https $ driver ,
45+ $ maxFileLength
4446 ) {
47+ $ this ->maxFileLength = $ maxFileLength ;
4548 $ this ->filesystem = $ filesystem ;
4649 $ this ->driver = $ driver ;
4750 }
@@ -59,11 +62,9 @@ public function __construct(
5962 public function execute (string $ imageUrl , string $ destinationPath = '' ) : string
6063 {
6164 $ mediaDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
62- $ maxFilenameLength = self ::MAX_LENGTH ;
63-
64- if (strlen ($ destinationPath ) > $ maxFilenameLength ) {
65+ if (strlen ($ destinationPath ) > $ this ->maxFileLength ) {
6566 throw new InputException (
66- __ ('Destination path is too long; must be %1 characters or less ' , $ maxFilenameLength )
67+ __ ('Destination path is too long; must be %1 characters or less ' , $ this -> maxFileLength )
6768 );
6869 }
6970
Original file line number Diff line number Diff line change 3737 <type name =" Magento\AdobeStockImage\Model\Storage\Save" >
3838 <arguments >
3939 <argument name =" driver" xsi : type =" object" >Magento\Framework\Filesystem\Driver\Https</argument >
40+ <argument name =" maxFileLength" xsi : type =" number" >255</argument >
4041 </arguments >
4142 </type >
4243 <type name =" Magento\AdobeStockImage\Model\GetRelatedImages" >
You can’t perform that action at this time.
0 commit comments