Closed (outdated)
Project:
Feeds
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Aug 2015 at 17:53 UTC
Updated:
9 Feb 2026 at 19:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
megachrizThis was reported too in #2510788: Remove query string from path in FeedsEnclosure.. Didn't the patch from that issue help?
Someone else that uses the jsonpath parser also noticed issues after updating Feeds, see #2548859: JSONPath import issues after update to Feeds 7.x-2.0-beta1 (I see you use the successor of that module, but maybe something in that issue could help). You can check your source with my Feeds import preview module. This allows you to see what your source looks like after it has been parsed.
By the way, the issue priority determines the seriousness of a bug to a project, not the priority for you, so I set it back to "normal". See also https://www.drupal.org/node/45111
Comment #3
iamfredrik commentedThe patch from https://www.drupal.org/node/2510788 fails on the latest dev. If I have time I will try to apply the changes from the patch manually.
Thanks, I will check out the Feeds import preview module.
Comment #4
iamfredrik commentedThe changes from feeds-remove-query-2510788-7.patch at https://www.drupal.org/node/2510788 are already applied in 7.x-2.0-beta1.
So no, the patch does not help.
Comment #5
megachrizThis issue has something to with cURL. After trying to import the supplied image, the following error is recorded in watchdog (for some reason not in the feeds log):
I'm not an expert in cURL, but a possible workaround could be to add an option to the file mapper to allow invalid SSL certificates, just as the HTTP Fetcher has.
This could be implemented this way (@iamfredrik I'm not saying you should do this, unless you are a coder):
$acceptInvalidCertto the FeedsEncloser class + a method to set it.file_feeds_set_target()call this setter method.FeedsEncloser::getContent(), pass$this->acceptInvalidCertto thehttp_request_get()call.But it would be better to fix cURL, if possible. Maybe there is a cURL option set wrong or there is a bug in PHP's cURL library.
Comment #6
iamfredrik commentedI just figured out what the problem was in my case. The update to the latest version changed the mapping of my image field to nothing. Removing the mapping and creating a new seems to have fixed the problem.
Comment #7
iamfredrik commentedI spoke too soon. It now seems to import some images, but not all.
Comment #8
iamfredrik commentedHmmm, I seem to have got all the images now that I deleted all created nodes and reimported everything. Before when I tried both the 'update' and 'replace existing nodes' settings and 'skip hash check', it didn't import the images.
Comment #9
temoor commentedPatch extends parser interface to allow specific implementations to pass "certificate error ignore" setting into further processing.
CSV parser was patched to expose SSL handling option in config form.
Comment #11
temoor commentedAdded necessary check.
Comment #12
megachrizHm, I think adjusting the CSV parser to fix this issue is not a good idea, because the issue isn't specific to the parser at all. The issue is specific to the file target. Therefore I think a solution should be implemented as a mapping option on the file target as suggested in #5.
Comment #13
megachrizClosed #2803989: File upload fetcher can't accept invalid SSL certificates as a duplicate which contains a patch with a quick & dirty fix (= always accept invalid certificates).
Comment #14
nmillin commentedI took a stab at what MegaChriz mentioned in #5.
The patch allows for fields to accept invalid SSL certificates per file mapping. I tried to follow the variable naming standard, but the patch will need some review.
Please let me know what you think and how this can be improved. Thanks.
Comment #15
megachrizThanks for your work! Sorry it took me a while before I was able to give it a review.
I tested it manually by fetching images from Drupal.org using an old system with which I have some SSL issues with. With the patch applied and the option enabled I was able to fetch an image from Drupal.org, while without the patch the image wasn't fetched. So the patch is doing it's job well!
Code review:
(minor) whitespace.
I think a check for
$mapping['accept_invalid_cert']is not needed. If it isFALSE, it can just pass that value to thegetFile()method.It seems that
_file_feeds_form_callback_options()is not needed. The constantFEEDS_FILE_ACCEPT_INVALID_CERTcan be removed as well. It is an on/off option.Simultaneously, the default value can just be
FALSE.Because it is more like an advanced setting, I think nothing has to be shown when the option is disabled.
These code comments can be removed.
The parameter
$accept_invalid_certshould be documented in the function docblock above.The parameter
$accept_invalid_certshould be optional and default toFALSE. There could be external code that is callinggetContent().Now that I'm looking at this, I wonder if it would be better to have the parameter defined as an
$optionsarray? This way it's easier to add additional options later and there would be less chance in breaking code in this case.Great work so far. Well done!
Comment #16
megachrizSince #1171114: Allow user to choose the method of file handling. was committed, the latest patch no longer applies.
Comment #17
nmillin commentedThanks MegaChriz. I've reviewed the patch from #1171114 and it looks like with that patch in, there is less code for this patch. The attached patch includes your comments from #15 except for changing
$optionsinto an array. Would that be out of scope for this issue?Please let me know what you think of the patch. Thanks.
Comment #18
nmillin commentedComment #20
megachrizThe patch is created against the Drupal root directory, it should be created against the Feeds directory.
Comment #21
nmillin commented#facepalm
Comment #22
twistor commentedI don't think this option should be in the UI. People will use it, and that's a problem. However, I also see a problem of having a global option, if you only want to enable it for one importer, hmmm.
Comment #23
nmillin commented;)
Joking aside, I copied the text to display the warning from admin/structure/feeds/[feed_machine_name]/settings/FeedsHTTPFetcher. Hopefully the warning is strong enough to warn people why not to check it.
My use case:
My feed uses the file upload fetcher, so I don't see the Accept invalid SSL certificates checkbox. It would be strange, to me, to see the Accept invalid SSL certificates checkbox at admin/structure/feeds/[feed_machine_name]/settings/FeedsFileFetcher when the page is referring to uploading a file. Ideally I would resolve the SSL issue so this isn't an issue for me, but sadly that isn't possible (long story).
I think this would be a nice feature to have in the feeds module, but that is just for my 1 use case. Thanks.
Comment #24
megachrizWe indeed don't want to encourage people to use this feature, but at the same time we don't want to slow down people if it is not needed. I have some problems with SSL on an old development machine, which I apparently only can solve by upgrading the system (which I will do, but takes time). In cases like these it is useful to have an option to skip the SSL check.
To keep the option a bit hidden, I thought it was best to not display its value in the summary when it was disabled (which I proposed in #15: "Because it is more like an advanced setting, I think nothing has to be shown when the option is disabled.").
What I was thinking about if we want to discourage people using the option was to display a warning on top of the page that it is discouraged to accept invalid certificates (only to be displayed when the option is enabled). This warning would be displayed on each configuration page of the importer. Or would that be too annoying?
Patch #21 review
file_feeds_summary_callback()in the patch from #14 may come back (but only return that line if the option is enabled of course). Maybe adding a warning sign to it would be nice.This can be merged into a single array.
For an optional parameter I usually start the description with '(optional)'. In the second line of the description I set what the default value is: 'Defaults to FALSE.', instead of adding
|FALSEnext to the variable name. Not sure if this is a coding standard or a personal preference.$optionsarray would be more future-proof. Imagine we want to add an option to set username/password somewhere and pass that tohttp_request_get(), thenFeedsEnclosure::getContent()could look like this:while
http_request_get()looks like this:I this example it is less elegant that the parameters of these two functions are in a different order.
We could also change it later when needed, but then it would be an API break. Let me know what you think of it.
I also tested the patch manually again and it is still working great! Thanks for your work!
Comment #25
bluegeek9 commentedDrupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.
If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!