File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
govtool/backend/src/VVA/API Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ changes.
1717### Fixed
1818
1919- Fix displaying DRep with doNotList property as string
20+ - Handle exception when no index is provided to /proposal/get endpoint [ Issue 1841] ( https://github.com/IntersectMBO/govtool/issues/1841 )
2021
2122### Changed
2223
Original file line number Diff line number Diff line change @@ -139,11 +139,14 @@ instance ToJSON GovActionId where
139139instance FromHttpApiData GovActionId where
140140 parseUrlPiece t = case Text. splitOn " #" t of
141141 [hash, rest] -> do
142- index <- case readMaybe $ Text. unpack rest of
143- Just x -> pure x
144- _ -> Left (Text. tail rest <> " is not a number" )
145- hexHash <- parseUrlPiece hash
146- Right $ GovActionId hexHash index
142+ if Text. null rest
143+ then Left " Missing index in hash#index format"
144+ else do
145+ index <- case readMaybe $ Text. unpack rest of
146+ Just x -> pure x
147+ _ -> Left (rest <> " is not a number" )
148+ hexHash <- parseUrlPiece hash
149+ Right $ GovActionId hexHash index
147150 _ -> Left " Not a valid hash#index value"
148151
149152exampleGovActionId :: Text
You can’t perform that action at this time.
0 commit comments