Fixed notes.js util to catch null values

This commit is contained in:
Glenn de Haan
2025-07-31 23:25:00 +02:00
parent 24b2ba0c42
commit 21f5be6a0a

View File

@@ -5,6 +5,15 @@
* @returns {*}
*/
module.exports = (string) => {
if(string === null) {
return {
note: null,
source: null,
auth_type: null,
auth_oidc_domain: null
};
}
const match = string.match(/^(?:(?<note>.*?)\|\|;;\|\|(?<source>[^|]*)\|\|;;\|\|(?<auth_type>[^|]*)\|\|;;\|\|(?<auth_oidc_domain>[^|]*)|(?<note_only>.+))$/);
const { note, source, auth_type, auth_oidc_domain, note_only } = match.groups;