Closed (fixed)
Project:
Node import
Version:
6.x-1.0-rc4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Mar 2010 at 17:19 UTC
Updated:
28 Mar 2010 at 21:10 UTC
During Step 3 of an import, if you set a "Text delimiter" and then set "Escape character" to "none", the import doesn't recognize the end of a text-delimited field.
For example, this
%title%|%description%
%Book%|%Book description goes here...%
parses as
title%|%description%|%Book%|%Book description goes here...%
This is because of
$pos_td = strpos($buffer, $td, $start);
$pos_ec = strpos($buffer, $ec . $td, $start);
if ($pos_td !== FALSE && ($pos_ec === FALSE || $pos_td <= ($pos_ec - strlen($td)))) {
in node_import_read_from_file() of node_import.inc.
If $ec is set to "none" then $td===$ec.$td therefore $pos_td===$pos_ec which fails the ($pos_ec === FALSE) condition.
I fixed it by changing the condition to this
if ($pos_td !== FALSE && ($td === $ec.$td || $pos_ec === FALSE || $pos_td <= ($pos_ec - strlen($td)))) {
to handle that case.
Sorry, I would submit a patch if I knew how.
Comments
Comment #1
Robrecht Jacques commentedFixed in -dev. Will be included in -rc5.
I have fixed it by doing:
which says there is no escaped delimiter when the escape character is empty.