Skip to content

Commit

Permalink
contacts: validate %nickname, %bio fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolajpp committed Sep 25, 2024
1 parent 5b7ed34 commit 9a21040
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion desk/lib/contacts.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,23 @@
::
?: (gth (met 3 (jam con)) 10.000)
|
:: prohibit data URLs in the image links
:: field restrictions
::
:: 1. %nickname field: max 64 characters
:: 2. %bio field: max 2048 characters
:: 3. data URLs in %avatar and %cover
:: are forbidden
::
=+ nickname=(~(get cy con) %nickname %text)
?: ?& ?=(^ nickname)
(gth (met 3 u.nickname) 64)
==
|
=+ bio=(~(get cy con) %bio %text)
?: ?& ?=(^ bio)
(gth (met 3 u.bio) 2.048)
==
|
=+ avatar=(~(get cy con) %avatar %text)
?: ?& ?=(^ avatar)
=('data:' (end 3^5 u.avatar))
Expand Down

0 comments on commit 9a21040

Please sign in to comment.