plan2net / webp

Create a WebP copy for images (TYPO3 CMS)
GNU General Public License v3.0
60 stars 33 forks source link

Filter generated webp files only #86

Closed kauz56 closed 1 year ago

kauz56 commented 1 year ago

This changes the filtering behaviour for file lists, so that it only filters generated webp files, but not regular, user submitted ones. These are distinguished by checking for a preceding file suffix before the ".webp".

Edit: @plan2net If you decide to merge this, please consider squashing the commits.

kauz56 commented 1 year ago

@xerc I'm sorry, I don't understand what you mean. Can you be more specific?

xerc commented 1 year ago

/\.[^\.]+\..*webp$ filters for expl. .x.xwebp which can not happen => just copy my statement

kauz56 commented 1 year ago

@xerc So you're saying my regex would match a file ".something.webp", whereas your's wouldn't? If so, I don't see any added value there, because the file list filters dotfiles by default. If it didn't filter dotfiles by default, a scenario where someone uploads a file .jpg would be possible. Resulting, the generation of a file .jpg.webp would also be possible, which my regex would then filter out correctly.

Feel free to correct me if I'm missing the point, but I don't think statements like "just copy my code" are very productive. If I'm asked to consider a change, I need to understand what I'd be changing and why.

xerc commented 1 year ago

your new regex matches fefewf.fcew.cefewebp which can not happen

kauz56 commented 1 year ago

@xerc Thanks for clarifying! I changed the commit accordingly.

xerc commented 1 year ago

np // please run php .Build/bin/php-cs-fixer fix --config php-cs-fixer.config.php & include the modif./cleanup and consider the \ ref. https://github.com/plan2net/webp/blame/master/Classes/Converter/PhpGdConverter.php#L66

kauz56 commented 1 year ago

Done. @plan2net If you decide to merge this, please consider squashing the commits.

wazum commented 1 year ago

@kauz56 Thanks, I solved this a little different, Commit 3b4f0715a0a6fe9f8bf24af8617fc5c99144009d in master (let me know if that works for you, then I'll tag it): I introduced a new extension configuration for the pattern to exclude (with a default pattern), so it's now totally flexible.

kauz56 commented 1 year ago

@wazum Works for me, thanks!

kauz56 commented 1 year ago

Closing, solved by https://github.com/plan2net/webp/commit/3b4f0715a0a6fe9f8bf24af8617fc5c99144009d.