aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-08-14 13:43:20 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-08-14 13:43:20 +0100
commit43bcd0398592aec7045ff6765aa001f86cdcc572 (patch)
tree32b674a51e0be24c4c26b472ce89f4aa4d923679
parent51772b463d007bf92d775536e94eaf42c7490995 (diff)
CSV export fix for e.g. spaces in category names.
-rw-r--r--perllib/FixMyStreet/Reporting.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Reporting.pm b/perllib/FixMyStreet/Reporting.pm
index 51dd6e97f..b5b5876b9 100644
--- a/perllib/FixMyStreet/Reporting.pm
+++ b/perllib/FixMyStreet/Reporting.pm
@@ -88,7 +88,8 @@ has filename => ( is => 'rw', isa => Str, lazy => 1, default => sub {
$self->on_updates ? ('updates') : (),
map {
my $value = $where{$_};
- (defined $value and length $value) ? ($_, $value) : ()
+ (my $nosp = $value) =~ s/ /-/g;
+ (defined $value and length $value) ? ($_, $nosp) : ()
} sort keys %where
});
@@ -328,14 +329,14 @@ sub kick_off_process {
my $cmd = FixMyStreet->path_to('bin/csv-export');
$cmd .= ' --cobrand ' . $self->cobrand->moniker;
- $cmd .= " --out $out";
+ $cmd .= " --out \Q$out\E";
foreach (qw(type category state start_date end_date)) {
- $cmd .= " --$_ " . $self->$_ if $self->$_;
+ $cmd .= " --$_ " . quotemeta($self->$_) if $self->$_;
}
foreach (qw(body user)) {
$cmd .= " --$_ " . $self->$_->id if $self->$_;
}
- $cmd .= " --wards " . join(',', @{$self->wards}) if @{$self->wards};
+ $cmd .= " --wards " . join(',', map { quotemeta } @{$self->wards}) if @{$self->wards};
$cmd .= ' &' unless FixMyStreet->test_mode;
system($cmd);