@@ -108,11 +108,11 @@ badNameMessage name problem =
108108verifyVersion :: Http. Token -> Memory. Memory -> Pkg. Name -> Text -> Text -> Snap. Snap Pkg. Version
109109verifyVersion token memory name commitHash rawVersion =
110110 case Pkg. versionFromText rawVersion of
111- Left problem ->
111+ Nothing ->
112112 Error. string 400 $
113- " I was given an invalid version: " ++ Text. unpack rawVersion ++ " \n\n " ++ problem
113+ " I was given an invalid version: " ++ Text. unpack rawVersion
114114
115- Right version ->
115+ Just version ->
116116 do verifyIsNew memory name version
117117 verifyTag token name version commitHash
118118 return version
@@ -147,15 +147,15 @@ getCommitHash token name version =
147147 Error. bytestring 500 " Request to GitHub API failed."
148148
149149 Right body ->
150- case Decode. parse tagDecoder body of
150+ case Decode. parse tagDecoder ( LBS. toStrict body) of
151151 Right hash ->
152152 return hash
153153
154154 Left _ ->
155155 Error. bytestring 500 " Request to GitHub API failed due to unexpected JSON."
156156
157157
158- tagDecoder :: Decode. Decoder Text
158+ tagDecoder :: Decode. Decoder e Text
159159tagDecoder =
160160 Decode. at [" object" ," sha" ] Decode. text
161161
@@ -184,7 +184,7 @@ uploadFiles name version time =
184184 if Set. fromList files /= requiredFiles then
185185 revert dir $ " Malformed request. Missing some metadata files."
186186 else
187- do bytes <- liftIO $ LBS .readFile (dir </> " elm.json" )
187+ do bytes <- liftIO $ BS .readFile (dir </> " elm.json" )
188188 case Decode. parse Project. pkgDecoder bytes of
189189 Left _ ->
190190 revert dir $ " Invalid content in elm.json file."
@@ -279,13 +279,13 @@ writeEndpoint name version dir stream =
279279 Right hash ->
280280 do Encode. writeUgly (dir </> " endpoint.json" ) $
281281 Encode. object
282- [ (" url" , Encode. string (toGithubUrl name version))
282+ [ (" url" , Encode. text (toGithubUrl name version))
283283 , (" hash" , Encode. text hash)
284284 ]
285285
286286 return $ Right " endpoint.json"
287287
288288
289- toGithubUrl :: Pkg. Name -> Pkg. Version -> String
289+ toGithubUrl :: Pkg. Name -> Pkg. Version -> Text. Text
290290toGithubUrl name version =
291- " https://github.com/" ++ Pkg. toUrl name ++ " /zipball/temp-" ++ Pkg. versionToString version ++ " /"
291+ " https://github.com/" <> Text. pack ( Pkg. toUrl name) <> " /zipball/temp-" <> Pkg. versionToText version <> " /"
0 commit comments