File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
AdobeStockImage/Model/Storage Expand file tree Collapse file tree 1 file changed +9
-0
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 ;
2627
2728 /**
2829 * @var Filesystem
@@ -66,6 +67,14 @@ public function __construct(
6667 */
6768 public function execute (string $ imageUrl , string $ destinationPath , bool $ allowOverwrite = false ): void
6869 {
70+ $ maxFilenameLength = self ::MAX_LENGTH ;
71+
72+ if (strlen ($ destinationPath ) > $ maxFilenameLength ) {
73+ throw new \LengthException (
74+ __ ('Destination Path is too long; must be %1 characters or less ' , $ maxFilenameLength )
75+ );
76+ }
77+
6978 $ mediaDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
7079
7180 if ($ this ->isPathExcluded ->execute ($ destinationPath )) {
You can’t perform that action at this time.
0 commit comments