diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 4db5a4f051..8751e77381 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -746,12 +746,14 @@ export default class TagRenderingConfig { if (freeformValue === "") { freeformValue = undefined } - if (this.freeform?.postfixDistinguished) { - const allValues = currentProperties[this.freeform.key].split(";").map((s) => s.trim()) + const pf = this.freeform?.postfixDistinguished + if (pf) { + const v = currentProperties[this.freeform.key] ?? "" + const allValues = v.split(";").map((s) => s.trim()) const perPostfix: Record = {} for (const value of allValues) { - const [v, postfix] = value.split("/") - perPostfix[postfix.trim()] = v.trim() + const [v, postfix] = value.split("/").map(s => s.trim()) + perPostfix[postfix ?? pf] = v.trim() } if (freeformValue === "" || freeformValue === undefined) { delete perPostfix[this.freeform.postfixDistinguished] @@ -1042,7 +1044,8 @@ export default class TagRenderingConfig { */ public markUnknown(layer: LayerConfig, currentProperties: Record): UploadableTag[] { if (this.freeform?.postfixDistinguished) { - const allValues = currentProperties[this.freeform.key].split(";").filter( + const v = currentProperties[this.freeform.key] ?? "" + const allValues = v.split(";").filter( part => part.split("/")[1]?.trim() !== this.freeform.postfixDistinguished ) return [new Tag(this.freeform.key, allValues.join(";"))] diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte index f78dc69162..e22f3d454d 100644 --- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -252,6 +252,8 @@ } else if (selectedTags instanceof And) { // Add the extraTags to the existing And selectedTags = [...TagTypes.uploadableAnd(selectedTags), ...extraTagsArray] + } else if (Array.isArray(selectedTags)) { + // pass } else { console.error( "selectedTags is not of type Tag or And, it is a " + JSON.stringify(selectedTags)