Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions modules/datastore/src/Plugin/QueueWorker/ImportJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,16 @@ protected function __construct(string $identifier, $storage, ?array $config = NU
}

/**
* Transform possible multiline string to single line for description.
* Sanitize column description (sanitize multiline and binary string)
*
* @param string $column
* Column name.
*
* @return string
* Column name on single line.
* sanitized column name on single line.
*/
public static function sanitizeDescription(string $column) {
$column = preg_replace('~[^\x20-\x7E\t\r\n]~', '_', $column);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefan-korn seems like it would be better to just remove the BOM rather than replace it with an underscore.

$trimmed = array_filter(array_map('trim', explode("\n", $column)));
return implode(" ", $trimmed);
}
Expand Down Expand Up @@ -159,6 +160,10 @@ public static function sanitizeHeader(string $column): string {
$column = '_' . $column;
}

if (empty($column)) {
$column = 'empty_col_name';
}

return $column;
}

Expand Down