I am using module Feeds Image Grabber (https://www.drupal.org/project/feeds_imagegrabber). It was working, but since release of version 7.x-2.0-alpha9 Feeds module, it no longer works.

It throws me error: ex. "The file_name.pngitoknn9ipbkQ has an invalid extension." (of course itok string is always different).

I am sure that a following fix in the latest release "#1848498 by twistor: Respect allowed file extensions in file mapper" causes the issue. I think that it should be fixed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

twistor’s picture

Title: Token in file name (itok) throws invalid extension error » Remove query string from path in FeedsEnclosure.

Yup, that is a bug, but, it existed before the patch, we just weren't as strict.

As an iterim fix, you can strip the token from the URL with feeds_tamper.

Can you tell me what the URL looks like it the feed?

iamfredrik’s picture

I have a similar issue with 7.x-2.0-alpha9. I'm importing feeds from Facebook using Feeds_ex JsonPath parser and importing images from urls with query strings fails without showing any error messages. I'm not using Feeds Image Grabber, I tested it, but could not get it to work at all.

Stripping the tokens using feeds_tamper cannot be done, because that removes access to the images.

Downgrading Feeds to 7.x-2.0-alpha8 fixed the problem!

twistor’s picture

Status: Active » Needs review
FileSize
1.7 KB
twistor’s picture

Version: 7.x-2.0-alpha9 » 7.x-2.x-dev

Tom1899’s picture

There is also another issue. If file has extension in uppercase ex. JPG instead of jpg, then it is not working too.

twistor’s picture

Yup.

  • twistor committed 1b14a06 on 7.x-2.x
    Issue #2510788 by twistor: Remove query string from path in...
twistor’s picture

Status: Needs review » Fixed
solucioteca’s picture

Thank you @twistor. Work for me

Status: Fixed » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: feeds-remove-query-2510788-7.patch, failed testing.

twistor’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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

joaogarin’s picture

Hello,

I am trying to import images using feeds from another CMS. I am running in an issue where removing the query string is causing some issues as in this CMS I do need the query string in the URL.

As feeds removes it the images can not be fetched. I think its a Microsoft CMS and despite the image url not being ideal (it uses the query string) that is how it works. Also feeds should probably just use just some better method like running the image through image_get_info() instead of relying on the image name or format.

best regards
Joao Garin

joaogarin’s picture

Status: Closed (fixed) » Needs review
joaogarin’s picture

I am proposing a patch here to roll back this to the previous state. Since this breaks the current site I am working on. Probably others as well.

Best regards
Joao Garin

twistor’s picture

How is this breaking things? Removing the query string only happens for the local file name, not the URL used to fetch the file.

joaogarin’s picture

Hello,

No this affects files being fetched outside Drupal.

In lines 457 of FeedsParser.inc :

$filename = $this->getLocalValue();
 if (module_exists('transliteration')) {
    require_once drupal_get_path('module', 'transliteration') . '/transliteration.inc';
    $filename = transliteration_clean_filename($filename);
 }

$file = file_save_data($this->getContent(), $destination . $filename);
         

getLocalValue() function calls getSafeFilename() which has these lines in the patches.

Best regards

kenorb’s picture

joaogarin’s picture

Yes @kenorb I am thinking they are probably related.