Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush logs an error when uploading new files #1

Open
DamienBurkeWN opened this issue Jun 16, 2022 · 0 comments
Open

Flush logs an error when uploading new files #1

DamienBurkeWN opened this issue Jun 16, 2022 · 0 comments

Comments

@DamienBurkeWN
Copy link

ResponsiveImageStyle:flush() is called when uploading a new file to Drupal's media library. At this point the file is in a temporary folder, no flush is necessary as no resized versions have been created yet. When a new RecursiveDirectoryIterator is created with the $base_style_path equal to "temporary://styles/responsive/temporary/" it provokes an Exception, and the catch below logs the exception needlessly in the error log (no harm has been done, the error is just noise).

Suggested solution:

Return early if $source_scheme is "temporary":

    $source_scheme = $scheme = StreamWrapperManager::getScheme($path);
    if ($source_scheme == 'temporary') {
      return $this;
    }

The logged error description was also unhelpful, as it says "problem finding responsive image derivatives", perhaps "flushing" would be better than "finding" for when there is a genuine problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant