Drupal does not accept settings uppercase image file extensions, such as JPG.
So when Feeds try save file by url this function give us fatal error and script is fall:

  protected function getFileName($url) {
    $filename = trim(drupal_basename($url), " \t\n\r\0\x0B.");
    $extension = substr($filename, strrpos($filename, '.') + 1);

    if (!in_array($extension, $this->fileExtensions)) {
      throw new TargetValidationException('The file, %url, failed to save because the extension, %ext, is invalid.', ['%url' => $url, '%ext' => $extension]);
    }

    return $filename;
  }

Propose replace it with this patch allow_import_image_with_uppercase_extensions__for_example_JPG.patch

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

osab created an issue. See original summary.

MegaChriz’s picture

Status: Reviewed & tested by the community » Needs work

The status 'RTBC' is only for meant for patches that have been thoroughly tested and the status should in most cases only be set by someone else than the patch author. See the documentation about setting this issue status: https://www.drupal.org/node/156119#rtbc

I set this to "Needs work" now, because you are removing the throw of an exception here, which is there for a good reason. If it causes a fatal error, then code further down the calling stack is broken. Somewhere this exception should be catched. See http://php.net/exceptions for information about what exceptions are. The following on that page is what I meant about catching exceptions:

When an exception is thrown, code following the statement will not be executed, and PHP will attempt to find the first matching catch block. If an exception is not caught, a PHP Fatal Error will be issued with an "Uncaught Exception ..." message

  • MegaChriz committed f214ecf on 8.x-3.x
    by MegaChriz: added image with uppercase extension as test source file...
MegaChriz’s picture

This patch should fix the issue. The tests only patch demonstrates the bug.

The last submitted patch, 5: feeds-uppercase-file-ext-2848792-4-tests-only.patch, failed testing. View results

  • MegaChriz committed b988bb6 on 8.x-3.x
    Issue #2848792 by MegaChriz, osab: Fixed make file extension check for...
MegaChriz’s picture

Status: Needs review » Fixed

Committed #5.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.