@@ -108,11 +108,11 @@ badNameMessage name problem =
108
108
verifyVersion :: Http. Token -> Memory. Memory -> Pkg. Name -> Text -> Text -> Snap. Snap Pkg. Version
109
109
verifyVersion token memory name commitHash rawVersion =
110
110
case Pkg. versionFromText rawVersion of
111
- Left problem ->
111
+ Nothing ->
112
112
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
114
114
115
- Right version ->
115
+ Just version ->
116
116
do verifyIsNew memory name version
117
117
verifyTag token name version commitHash
118
118
return version
@@ -147,15 +147,15 @@ getCommitHash token name version =
147
147
Error. bytestring 500 " Request to GitHub API failed."
148
148
149
149
Right body ->
150
- case Decode. parse tagDecoder body of
150
+ case Decode. parse tagDecoder ( LBS. toStrict body) of
151
151
Right hash ->
152
152
return hash
153
153
154
154
Left _ ->
155
155
Error. bytestring 500 " Request to GitHub API failed due to unexpected JSON."
156
156
157
157
158
- tagDecoder :: Decode. Decoder Text
158
+ tagDecoder :: Decode. Decoder e Text
159
159
tagDecoder =
160
160
Decode. at [" object" ," sha" ] Decode. text
161
161
@@ -184,7 +184,7 @@ uploadFiles name version time =
184
184
if Set. fromList files /= requiredFiles then
185
185
revert dir $ " Malformed request. Missing some metadata files."
186
186
else
187
- do bytes <- liftIO $ LBS .readFile (dir </> " elm.json" )
187
+ do bytes <- liftIO $ BS .readFile (dir </> " elm.json" )
188
188
case Decode. parse Project. pkgDecoder bytes of
189
189
Left _ ->
190
190
revert dir $ " Invalid content in elm.json file."
@@ -279,13 +279,13 @@ writeEndpoint name version dir stream =
279
279
Right hash ->
280
280
do Encode. writeUgly (dir </> " endpoint.json" ) $
281
281
Encode. object
282
- [ (" url" , Encode. string (toGithubUrl name version))
282
+ [ (" url" , Encode. text (toGithubUrl name version))
283
283
, (" hash" , Encode. text hash)
284
284
]
285
285
286
286
return $ Right " endpoint.json"
287
287
288
288
289
- toGithubUrl :: Pkg. Name -> Pkg. Version -> String
289
+ toGithubUrl :: Pkg. Name -> Pkg. Version -> Text. Text
290
290
toGithubUrl 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