When getting the .csv template file that comes with feeds by default the first rows (one or more) are always empty.

A call to ob_clean right before pinting out the file content solves the problem (as per patch).

Comments

JulienF’s picture

Find the attached patch to fix this issue

megachriz’s picture

Status: Active » Postponed (maintainer needs more info)

Under what kind of circumstances does this problem occur? When I download the CSV template I get the headers in the first row.

JulienF’s picture

Can you clarify what do you mean by circumstances ?

Since this is probably related to the server on which drupal is being hosted, the issue appears under Drupal 7.34 for websites hosted at omega8 (haven't tried on another host).

If you need more details let me know, I'll gladly provide them.

megachriz’s picture

In order to evaluate if the proposed fix is the right one, I need to be able to reproduce the issue first. Sometimes a patch may just fix a symptom of the problem. For example, the issue could be caused by a misconfiguration on the server side.

  • Could you try the latest dev to ensure the problem is still present there?
  • Can you check if the same problem occurs with an other importer? For example, enable the "Feeds Import" module and check with both the importers "Node import" and "User import". If the outcome is different, then the issue may be related to importer configuration. If this is the case, can you attach an export of your Feeds importer?
  • If the problem is related to server configuration, it may be harder to track the cause of the issue down. What you could do is install a local server (you can set that up easily with for example XAMPP or Acquia Dev Desktop) and try to reproduce the problem on your localhost to find out which server settings have influence on the issue.
riaan burger’s picture

Title: The CSV template file always comes with an empty first row » The CSV template file always comes with one or more empty first rows
Issue summary: View changes

Unfortunately I have no clean extra information to supply regarding the circumstances under which this happens as I just quickly helped someone with a rather complex and mature site.

Experienced four extra lines before the data, which, if the site owner were to use the template, would result in four empty entities being created.

The patch solved the problem.

sophie.sk’s picture

StatusFileSize
new1.81 KB

Maybe I can chime in as we're experiencing the same problem. Updated to the latest dev and the problem persists.

I've attached the export of one of our importers. Some other information:
* We had version 7.x-2.0-alpha9 before I updated to the dev version from 6th August
* The importer was originally created using Features
* We have three importers and all three have this problem - two empty lines at the start of the template file
* I've tried debugging but the output seems correct (no extra array items)
* The same thing happens with the Node and User import provided by Feeds
* This is all happening on my localhost setup (Ubuntu 14.04 LAMP stack) and on live sites
* Unable to reproduce on another client site running Feeds 7.x-2.0-alpha8+102-dev with multiple patches to support Feeds Entity Importer
The patch in #1 did indeed solve the problem.

I'm going to apply it but will keep checking back here.

JulienF’s picture

Version: 7.x-2.0-alpha8 » 7.x-2.0-beta1
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new557 bytes

I've added the same patch but to apply to v2.0 beta1

Status: Needs review » Needs work

The last submitted patch, 7: feeds-CSV_Template_file_empty_rows-2428777-7.diff, failed testing.

megachriz’s picture

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

Patches should be made against dev. Can this bug be demonstrated with an automated test?

fadi.assaad’s picture

Same patch for v2.0 beta3

bluegeek9’s picture

Status: Needs work » Closed (outdated)

Drupal 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!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.