Skip to content

Commit

Permalink
Merge branch 'fix-apostrophes'
Browse files Browse the repository at this point in the history
  • Loading branch information
koterpillar committed Sep 23, 2017
2 parents eb0a505 + e57d00c commit 9c63974
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Fetcher/EPA.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Control.Monad
import Control.Monad.IO.Class

import Data.Aeson
import qualified Data.List.Utils as L
import Data.Maybe
import Data.Time.Clock
import Data.Time.Format
Expand Down Expand Up @@ -47,7 +48,7 @@ forecastAddress location =
abbr ++
"/JSON"
where
city = location ^. locCity
city = L.replace "'" "''" $ location ^. locCity
abbr = location ^. locRegion . to usStateAbbreviation

data ForecastItem = ForecastItem
Expand Down
6 changes: 5 additions & 1 deletion src/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ removeAccents = T.filter (not . isMark) . normalize NFD

-- Replace characters not allowed in Pebble pin IDs and topic names
normalizeValue :: T.Text -> T.Text
normalizeValue = T.replace " " "_" . removeAccents
normalizeValue = T.map removeInvalidChars . removeAccents
where
removeInvalidChars ' ' = '_'
removeInvalidChars '\'' = '_'
removeInvalidChars c = c

maybeMaximum :: Ord a => [a] -> Maybe a
maybeMaximum [] = Nothing
Expand Down

0 comments on commit 9c63974

Please sign in to comment.