@@ -225,6 +225,8 @@ public function __construct(
225
225
*
226
226
* @param string $path
227
227
* @return void
228
+ * @throws \Magento\Framework\Exception\FileSystemException
229
+ * @throws \Magento\Framework\Exception\ValidatorException
228
230
*/
229
231
protected function createSubDirectories ($ path )
230
232
{
@@ -295,6 +297,7 @@ protected function removeItemFromCollection($collection, $conditions)
295
297
*
296
298
* @param string $path Parent directory path
297
299
* @return \Magento\Framework\Data\Collection\Filesystem
300
+ * @throws \Exception
298
301
*/
299
302
public function getDirsCollection ($ path )
300
303
{
@@ -393,6 +396,7 @@ public function getFilesCollection($path, $type = null)
393
396
*
394
397
* @param string $path Path to the directory
395
398
* @return \Magento\Cms\Model\Wysiwyg\Images\Storage\Collection
399
+ * @throws \Exception
396
400
*/
397
401
public function getCollection ($ path = null )
398
402
{
@@ -485,6 +489,9 @@ public function deleteDirectory($path)
485
489
*
486
490
* @param string $path
487
491
* @return void
492
+ * @throws \Magento\Framework\Exception\FileSystemException
493
+ * @throws \Magento\Framework\Exception\LocalizedException
494
+ * @throws \Magento\Framework\Exception\ValidatorException
488
495
*/
489
496
protected function _deleteByPath ($ path )
490
497
{
@@ -500,6 +507,8 @@ protected function _deleteByPath($path)
500
507
*
501
508
* @param string $target File path to be deleted
502
509
* @return $this
510
+ * @throws \Magento\Framework\Exception\FileSystemException
511
+ * @throws \Magento\Framework\Exception\ValidatorException
503
512
*/
504
513
public function deleteFile ($ target )
505
514
{
@@ -561,9 +570,11 @@ public function uploadFile($targetPath, $type = null)
561
570
/**
562
571
* Thumbnail path getter
563
572
*
564
- * @param string $filePath original file path
565
- * @param bool $checkFile OPTIONAL is it necessary to check file availability
573
+ * @param string $filePath original file path
574
+ * @param bool $checkFile OPTIONAL is it necessary to check file availability
566
575
* @return string|false
576
+ * @throws \Magento\Framework\Exception\FileSystemException
577
+ * @throws \Magento\Framework\Exception\ValidatorException
567
578
*/
568
579
public function getThumbnailPath ($ filePath , $ checkFile = false )
569
580
{
@@ -587,9 +598,11 @@ public function getThumbnailPath($filePath, $checkFile = false)
587
598
/**
588
599
* Thumbnail URL getter
589
600
*
590
- * @param string $filePath original file path
591
- * @param bool $checkFile OPTIONAL is it necessary to check file availability
601
+ * @param string $filePath original file path
602
+ * @param bool $checkFile OPTIONAL is it necessary to check file availability
592
603
* @return string|false
604
+ * @throws \Magento\Framework\Exception\FileSystemException
605
+ * @throws \Magento\Framework\Exception\ValidatorException
593
606
*/
594
607
public function getThumbnailUrl ($ filePath , $ checkFile = false )
595
608
{
@@ -610,6 +623,8 @@ public function getThumbnailUrl($filePath, $checkFile = false)
610
623
* @param string $source Image path to be resized
611
624
* @param bool $keepRatio Keep aspect ratio or not
612
625
* @return bool|string Resized filepath or false if errors were occurred
626
+ * @throws \Magento\Framework\Exception\FileSystemException
627
+ * @throws \Magento\Framework\Exception\ValidatorException
613
628
*/
614
629
public function resizeFile ($ source , $ keepRatio = true )
615
630
{
@@ -643,6 +658,9 @@ public function resizeFile($source, $keepRatio = true)
643
658
*
644
659
* @param string $filename File basename
645
660
* @return bool|string Thumbnail path or false for errors
661
+ * @throws \Magento\Framework\Exception\FileSystemException
662
+ * @throws \Magento\Framework\Exception\LocalizedException
663
+ * @throws \Magento\Framework\Exception\ValidatorException
646
664
*/
647
665
public function resizeOnTheFly ($ filename )
648
666
{
@@ -658,6 +676,8 @@ public function resizeOnTheFly($filename)
658
676
*
659
677
* @param bool|string $filePath Path to the file
660
678
* @return string
679
+ * @throws \Magento\Framework\Exception\FileSystemException
680
+ * @throws \Magento\Framework\Exception\ValidatorException
661
681
*/
662
682
public function getThumbsPath ($ filePath = false )
663
683
{
@@ -782,17 +802,28 @@ protected function _validatePath($path)
782
802
*
783
803
* @param string $path
784
804
* @return string
805
+ * @throws \Magento\Framework\Exception\ValidatorException
785
806
*/
786
807
protected function _sanitizePath ($ path )
787
808
{
788
- return rtrim (preg_replace ('~[/ \\\]+~ ' , '/ ' , $ this ->_directory ->getDriver ()->getRealPathSafety ($ path )), '/ ' );
809
+ return rtrim (
810
+ preg_replace (
811
+ '~[/ \\\]+~ ' ,
812
+ '/ ' ,
813
+ $ this ->_directory ->getDriver ()->getRealPathSafety (
814
+ $ this ->_directory ->getAbsolutePath ($ path )
815
+ )
816
+ ),
817
+ '/ '
818
+ );
789
819
}
790
820
791
821
/**
792
822
* Get path in root storage dir
793
823
*
794
824
* @param string $path
795
825
* @return string|bool
826
+ * @throws \Magento\Framework\Exception\ValidatorException
796
827
*/
797
828
protected function _getRelativePathToRoot ($ path )
798
829
{
0 commit comments