Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/infrastructure/export/format/PhabricatorCSVExportFormat.php b/src/infrastructure/export/format/PhabricatorCSVExportFormat.php
index 8f3879d5fb..f9d8bf1ad3 100644
--- a/src/infrastructure/export/format/PhabricatorCSVExportFormat.php
+++ b/src/infrastructure/export/format/PhabricatorCSVExportFormat.php
@@ -1,70 +1,70 @@
<?php
final class PhabricatorCSVExportFormat
extends PhabricatorExportFormat {
const EXPORTKEY = 'csv';
private $rows = array();
public function getExportFormatName() {
return pht('Comma-Separated Values (.csv)');
}
public function isExportFormatEnabled() {
return true;
}
public function getFileExtension() {
return 'csv';
}
public function getMIMEContentType() {
return 'text/csv';
}
public function addHeaders(array $fields) {
$headers = mpull($fields, 'getLabel');
$this->addRow($headers);
}
public function addObject($object, array $fields, array $map) {
$values = array();
foreach ($fields as $key => $field) {
$value = $map[$key];
$value = $field->getTextValue($value);
$values[] = $value;
}
$this->addRow($values);
}
private function addRow(array $values) {
$row = array();
foreach ($values as $value) {
// Excel is extremely interested in executing arbitrary code it finds in
// untrusted CSV files downloaded from the internet. When a cell looks
// like it might be too tempting for Excel to ignore, mangle the value
// to dissuade remote code execution. See T12800.
- if (preg_match('/^\s*[+=@-]/', $value)) {
+ if ($value && preg_match('/^\s*[+=@-]/', $value)) {
$value = '(!) '.$value;
}
- if (preg_match('/\s|,|\"/', $value)) {
+ if ($value && preg_match('/\s|,|\"/', $value)) {
$value = str_replace('"', '""', $value);
$value = '"'.$value.'"';
}
$row[] = $value;
}
$this->rows[] = implode(',', $row);
}
public function newFileData() {
return implode("\n", $this->rows);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Apr 28, 10:42 AM (1 d, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
107929
Default Alt Text
(2 KB)

Event Timeline