JpegOptim generated file permissions

Created on 6 July 2017, over 7 years ago
Updated 21 February 2025, about 1 month ago

Hi,

I think this module should be sending the --preserve-perms flag to jpegoptim, as with the current setup all images generated by jpegoptim are pretty likely to be unreadable by the webserver.

Consider the following (very common) setup:

  • Website files owned by user `bob`
  • PHP: 7.1 (fpm) running workers as user `bob`
  • NGINX running as default user `www-data` proxying through to FPM through fastcgi

This results in the following workflow:

  1. Images uploaded via the CMS will be using the default permissions as defined by the user's umask (in my case 644).
  2. Drupal creates and image style and also saves it with 644
  3. Reduced image is passed through to jpegoptim, which does not honour umask and re-saves as 600 by default
  4. NGINX can no longer serve the file due to incorrect permissions

This should be a safe change as the files should then just follow the user's umask (as per any other file saved by Drupal).

πŸ› Bug report
Status

Needs review

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom mattjones86 πŸ‡¬πŸ‡§ GMT+0

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024