Paths to the seach visitors could be simplified #9

Open
opened 2025-04-08 01:23:11 +00:00 by King_DuckZ · 0 comments
Owner

Visitor supports path entries like /[[2]] for example to mean the 3rd element in an array. I think I can safely remove the [[ ]] around the number as all the visitor has to do is to grab an index while sitting on an array node. If it got anything other than a number that would be a mistake, likewise getting a number while on a map node for example would return an error unless by coincidence there was a key in that map that matched the number. Right now there is also no special error detection code on the map case and I believe 2 and [[2]] are equally unlikely keys for a map in a torrent file.

Visitor supports path entries like `/[[2]]` for example to mean the 3rd element in an array. I think I can safely remove the `[[ ]]` around the number as all the visitor has to do is to grab an index while sitting on an array node. If it got anything other than a number that would be a mistake, likewise getting a number while on a map node for example would return an error unless by coincidence there was a key in that map that matched the number. Right now there is also no special error detection code on the map case and I believe `2` and `[[2]]` are equally unlikely keys for a map in a torrent file.
King_DuckZ added the
enhancement
label 2025-04-08 01:23:42 +00:00
Sign in to join this conversation.
No labels
bug
enhancement
licence
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: King_DuckZ/ducktorrent#9
No description provided.