View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0010420 | mantisbt | csv | public | 2009-04-27 08:02 | 2009-06-23 15:26 |
| Reporter | kesterhabermann | Assigned To | grangeway | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | any | OS | any | OS Version | any |
| Product Version | 1.1.7 | ||||
| Fixed in Version | 1.2.0rc1 | ||||
| Summary | 0010420: Custom fields with newline break CSV export | ||||
| Description | Multiline entries in custom fields break CSV export as the newlines appear in the CSV. The following change to "csv_export.php" and "core/csv_api.php" will remove the newlines in the CSV export for all fields: --- mantisbt-1.1.7.orig/csv_export.php 2009-04-20 15:14:00.000000000 +0200
| ||||
| Tags | No tags attached. | ||||
| Attached Files | mantisbt-1.1.7-csv.patch (937 bytes)
--- mantisbt-1.1.7.orig/csv_export.php 2009-04-20 15:14:00.000000000 +0200
+++ mantisbt-1.1.7/csv_export.php 2009-04-27 14:06:47.845381000 +0200
@@ -116,11 +116,7 @@
helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row, COLUMNS_TARGET_CSV_PAGE ) );
$t_value = ob_get_clean();
- if ( strstr( $t_value, $t_sep ) !== false ) {
- $t_value = '"' . $t_value . '"';
- }
-
- echo $t_value;
+ echo csv_escape_string($t_value);
} else {
$t_function = 'csv_format_' . $t_column;
echo $t_function( $t_row[ $t_column ] );
--- mantisbt-1.1.7.orig/core/csv_api.php 2009-04-20 15:14:00.000000000 +0200
+++ mantisbt-1.1.7/core/csv_api.php 2009-04-27 11:23:37.844829000 +0200
@@ -57,6 +57,9 @@
$p_str = '"' . str_replace( '"', '""', $p_str ) . '"';
}
+ $p_str = str_replace("\n", '', $p_str);
+ $p_str = str_replace("\r", '', $p_str);
+
return $p_str;
}
| ||||