fix: do not throw exception when passing nil to utils.address/get-abbreviated-profile-url (#19593)
This commit is contained in:
parent
98d4969ca5
commit
6872d1a857
|
@ -46,7 +46,7 @@
|
|||
with the 1st 5 characters of the encoded data followed by an ellipsis
|
||||
followed by the last 10 characters of the compressed public key"
|
||||
[universal-profile-url]
|
||||
(when-let [re-find-result (re-find #"^https://(status.app/u/)(.*)#(.*)$" universal-profile-url)]
|
||||
(when-let [re-find-result (re-find #"^https://(status.app/u/)(.*)#(.*)$" (str universal-profile-url))]
|
||||
(let [[_whole-url base-url encoded-data public-key] re-find-result]
|
||||
(when (> (count public-key) 9)
|
||||
(let [first-part-of-encoded-data (subs encoded-data 0 5)
|
||||
|
|
|
@ -35,4 +35,7 @@
|
|||
"https://status.app/uwu/abcdefg#zQ3shPrnUhhR42JJn3QdhodGest8w8MjiH8hPaimrdYpzeFUa"))))
|
||||
|
||||
(testing "Ensure the function returns nil when given a public key shorter than 10 characters"
|
||||
(is (nil? (utils.address/get-abbreviated-profile-url "https://status.app/u/abcdefg#012345678")))))
|
||||
(is (nil? (utils.address/get-abbreviated-profile-url "https://status.app/u/abcdefg#012345678"))))
|
||||
|
||||
(testing "Ensure the function returns nil when given nil"
|
||||
(is (nil? (utils.address/get-abbreviated-profile-url nil)))))
|
||||
|
|
Loading…
Reference in New Issue