git-annex/Messages
Joey Hess 438e5b56aa
tighter --json parsing for metadata
metadata --batch --json: Reject input whose "fields" does not consist of
arrays of strings. Such invalid input used to be silently ignored.

Used to be that parseJSON for a JSONActionItem ran parseJSON separately
for the itemAdded, and if that failed, did not propagate the error. That
allowed different items with differently named fields to be parsed.
But it was actually only used to parse "fields" for metadata, so that
flexability is not needed.

The fix is just to parse "fields" as-is. AddJSONActionItemFields is needed
only because of the wonky way Command.MetaData adds onto the started json
object.

Note that this line got a dummy type signature added,
just because the type checker needs it to be some type.
itemFields = Nothing :: Maybe Bool
Since it's Nothing, it doesn't really matter what type it is,
and the value gets turned into json and is then thrown away.

Sponsored-by: Kevin Mueller on Patreon
2021-11-01 14:42:37 -04:00
..
Concurrent.hs generalize to allow running in Assistant monad 2020-12-04 13:07:30 -04:00
Internal.hs clear progress bar before displaying messages 2021-06-15 20:51:40 -04:00
JSON.hs tighter --json parsing for metadata 2021-11-01 14:42:37 -04:00
Progress.hs bwlimit 2021-09-21 16:58:10 -04:00
Serialized.hs bwlimit 2021-09-21 16:58:10 -04:00