Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ changes.
### Fixed

- Fix displaying DRep with doNotList property as string
- Handle exception when no index is provided to /proposal/get endpoint [Issue 1841](https://github.com/IntersectMBO/govtool/issues/1841)

### Changed

Expand Down
13 changes: 8 additions & 5 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,14 @@ instance ToJSON GovActionId where
instance FromHttpApiData GovActionId where
parseUrlPiece t = case Text.splitOn "#" t of
[hash, rest] -> do
index <- case readMaybe $ Text.unpack rest of
Just x -> pure x
_ -> Left (Text.tail rest <> " is not a number")
hexHash <- parseUrlPiece hash
Right $ GovActionId hexHash index
if Text.null rest
then Left "Missing index in hash#index format"
else do
index <- case readMaybe $ Text.unpack rest of
Just x -> pure x
_ -> Left (rest <> " is not a number")
hexHash <- parseUrlPiece hash
Right $ GovActionId hexHash index
_ -> Left "Not a valid hash#index value"

exampleGovActionId :: Text
Expand Down