Skip to content

Flush logs an error when uploading new files #1

@DamienBurkeWN

Description

@DamienBurkeWN

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions