@@ -565,17 +565,16 @@ fetchItem sourceDir s =
565 cont <- B.readFile f
565 cont <- B.readFile f
566 return (cont, mime)
566 return (cont, mime)
568−-- TODO - have this return mime type too - then it can work for google
570-- | Read from a URL and return raw data and maybe mime type.
568-- | Read from a URL and return raw data and maybe mime type.
571openURL :: String -> IO (B.ByteString, Maybe String)
569openURL :: String -> IO (B.ByteString, Maybe String)
572openURL u = getBodyAndMimeType `fmap`
570openURL u = getBodyAndMimeType `fmap`
573− browse (setAllowRedirects True >> request (getRequest' u))
571+ browse (setAllowRedirects True >> request (getRequest' u'))
574 where getBodyAndMimeType (_, r) = (rspBody r, findHeader HdrContentType r)
572 where getBodyAndMimeType (_, r) = (rspBody r, findHeader HdrContentType r)
575 getRequest' uriString = case parseURI uriString of
573 getRequest' uriString = case parseURI uriString of
576 Nothing -> error ("Not a valid URL: " ++
574 Nothing -> error ("Not a valid URL: " ++
577 uriString)
575 uriString)
578 Just v -> mkRequest GET v
576 Just v -> mkRequest GET v
577+ u' = escapeURIString (/= '|') u -- pipes are rejected by Network.URI
581-- Error reporting
580-- Error reporting