mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-04 19:21:53 +00:00
handle edge case for short key strings
This commit is contained in:
committed by
Brandon Lee Kitajchuk
parent
28d9bbf98e
commit
ec73bcef53
@@ -19,6 +19,10 @@ const obscureKey = (key) => {
|
||||
const key_spoiler_length = 6;
|
||||
const key_spoiler_char = 'X';
|
||||
|
||||
if (key.length <= key_spoiler_length) {
|
||||
return key;
|
||||
}
|
||||
|
||||
return `${key.slice(0, key_spoiler_length)}${key_spoiler_char.repeat(key.length - key_spoiler_length)}`;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user