xperseguers / t3ext-image_autoresize

TYPO3 Extension image_autoresize. Simplify the way your editors may upload their images.
https://extensions.typo3.org/extension/image_autoresize
GNU General Public License v3.0
16 stars 22 forks source link

No processing of images if mountpoint is subfolder of configured directory #84

Closed sebastianstein closed 10 months ago

sebastianstein commented 1 year ago

We encountered a problem in combination with mountpoints if the mountpoint folder is inside of a configured directory.

TYPO3: 11.5.x image_autoresize: 2.2.1

Testsetup:

Fileadmin Path: /my/absolute/path/fileadmin/

File Storage:

  Uid: 1
  Name: fileadmin
  basePath: fileadmin/

Filemount:

  Uid: 1
  Name: SubfolderMount
  Path: /main_folder/sub_folder/

Backend User:

  Uid: 1
  Name: User1
  Mountpoint: SubfolderMount

Configuration:

 return [
    'directories' => '1:/main_folder/,uploads/',
    'file_types' => 'jpg,jpeg,png',
    'threshold' => '500K',
    'max_width' => '1920',
    'max_height' => '1920',
    'max_size' => '100M',
    'auto_orient' => '1',
    'conversion_mapping' => 'ai => jpg,bmp => jpg,pcx => jpg,tga => jpg,tif => jpg,tiff => jpg',
    'keep_metadata' => '1',
    'resize_png_with_alpha' => '1',
  ];
  1. Switch to User: User1
  2. Upload File to SubfolderMount
  3. The file will not be processed despite the folder "subfolder" is located in folder "mainfolder" which should be processed.

    I think this is due to the called function $folder->getReadablePath(). In case of a mountpoint this function does not return the complete path (/mainfolder/subfolder/) but (/subfolder/). This has the consequence that "preg_match($directoryConfig['pattern'], $relTargetFileName)" fails. Since $directoryConfig['pattern'] in this case checks for "/^main_folder\/([^\/]+\/)*/" and is not set in $relTargetFileName (/my/absolute/path/fileadmin/sub_foler/).

xperseguers commented 11 months ago

Yes, I just fixed it but missed that ticket for the reference, please try again.