Skip to content

Commit

Permalink
contacts: improve +sane-contact sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolajpp committed Oct 14, 2024
1 parent d8ffc6c commit a6aca98
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions desk/lib/contacts.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
::
:: - restrict size of the jammed noun to 10kB
:: - prohibit 'data:' URLs in image data
:: - nickname and bio must be a %text
:: - avatar and cover must be %look
:: - groups must be a %set of %flags
::
++ sane-contact
|= con=contact
Expand Down Expand Up @@ -202,6 +205,16 @@
=('data:' (end 3^5 u.cover))
==
|
?. (~(typ cy con) %groups %set) |
=+ groups=(~(get cy con) %groups %set)
:: verifying the type of the first set element is enough,
:: set uniformity is verified by +soft above.
::
?: ?& ?=(^ groups)
?=(^ u.groups)
!?=(%flag -.n.u.groups)
==
|
&
:: +do-edit: edit contact
::
Expand Down

0 comments on commit a6aca98

Please sign in to comment.