Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Commit abb63d9

Browse files
authored
Ensure filenames don't contain spaces (#4125)
1 parent aad2933 commit abb63d9

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/DDG/Goodie/Geometry.pm

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,34 @@ triggers any => @finalWords;
2929
my ($shapes, $formulas) = LoadFile(share('objectInfo.yml'));
3030

3131
handle remainder => sub {
32-
32+
3333
return unless $_;
34-
34+
3535
my $remainder = lc($_);
3636

3737
return unless my $shape = $shapes->{$remainder};
38-
38+
3939
my %dataFormula;
4040
# Fill dataFormula with values for handlebar to parse
4141
foreach my $key (keys $shape) {
42-
42+
4343
$dataFormula{$key} = {
4444
'nameCaps' => ucfirst($key),
4545
'color' => $formulas->{$key}{'color'},
4646
'symbol' => $formulas->{$key}{'symbol'},
4747
'html' => $shape->{$key}
4848
};
49-
49+
5050
}
51-
51+
52+
my $filename = $remainder;
53+
$filename =~ s/\s/-/g;
54+
5255
return "plain text response", structured_answer => {
5356
data => {
5457
title => ucfirst($remainder),
5558
formulas => \%dataFormula,
56-
svg => LoadFile(share("svg/$remainder.svg")),
59+
svg => LoadFile(share("svg/$filename.svg")),
5760
},
5861
templates => {
5962
group => "text",

0 commit comments

Comments
 (0)