diff options
Diffstat (limited to 'cgi/index.pl')
-rw-r--r-- | cgi/index.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cgi/index.pl b/cgi/index.pl index c02fbac..4134e4e 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -20,13 +20,18 @@ sub get_results_for { default_expires => $refresh_interval . ' sec', ); - my $results = $cache->thaw($station); + # Cache::File has UTF-8 problems, so strip it (and any other potentially + # problematic chars). + my $cstation = $station; + $cstation =~ tr{[0-9a-zA-Z -]}{}cd; + + my $results = $cache->thaw($cstation); if ( not $results ) { my $status = Travel::Status::DE::DeutscheBahn->new( station => $station ); $results = [ $status->results ]; - $cache->freeze( $station, $results ); + $cache->freeze( $cstation, $results ); } return @{$results}; |