Problem/Motivation

I am seeing the following message when trying to import an image from a RSS feed when the URL contains a query string:

The file, http://x.x.x/uploads/162/500_bgklm.jpg?10000, failed to save because the extension, jpg?10000, is invalid

Proposed resolution

Strip the querystring from the filename.

Remaining tasks

Tests

User interface changes

None.

API changes

None.

Data model changes

None

Comments

andyrigby created an issue. See original summary.

andyrigby’s picture

socialnicheguru’s picture

Status: Active » Needs review
socialnicheguru’s picture

Status: Needs review » Needs work

Can this be rerolled against the latest dev?

git apply feeds-url-with-queryparam-filename-2977565-1.patch
error: patch failed: src/Feeds/Target/File.php:212
error: src/Feeds/Target/File.php: patch does not apply

patch -p1 < feeds-url-with-queryparam-filename-2977565-1.patch
patching file src/Feeds/Target/File.php
Hunk #1 FAILED at 212.
1 out of 1 hunk FAILED -- saving rejects to file src/Feeds/Target/File.php.rej

icampana’s picture

Just found this issue, actually I encountered the same issue while working on the MediaRSS support, so the same fix is included on the patch included in this issue (https://www.drupal.org/project/feeds/issues/3049802).

If it gets approved it should also solve this problem.

PierreRicci’s picture

megachriz’s picture

Issue tags: +Feeds file target

There are more file target related issues. Tagging this with “Feeds file target”.

afireintheattic’s picture

Status: Needs work » Needs review

Patch in #6 worked great for me. Marking as Needs Review as we should probably get some more eyes/reviews on this. Thanks!

tyler-durden’s picture

+1 for patch in #6, I have tested it with dozens of feeds I created and it has worked lawlessly. Would love to see this in the next Beta release as it is just one line of extra code needed.

megachriz’s picture

Thanks for the patch! Now with test coverage.

  • MegaChriz committed 810042c on 8.x-3.x authored by andyrigby
    Issue #2977565 by MegaChriz, andyrigby, PierreRicci, tyler-durden,...
megachriz’s picture

Status: Needs review » Fixed

Committed #10. Thanks all for testing!

Status: Fixed » Closed (fixed)

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

jandewit6’s picture

In line with this issue, I have something similar with feed importing pdf files when the download url ends with /?ext=pdf.
Same issue as reported earlier, feeds importer indicates that the extension is invalid.

Am using Feeds 8.x-3.0-alpha10.