From 435f51a7777927aec307df8ade97b911f2080eba Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Thu, 9 Sep 2021 09:20:48 +0200 Subject: [PATCH] Fix for crowdfund perk editor With no title entered, the editor got stuck in an endless loop, because it recursively invoked the save function without checking for the ID fallback being present. Fixes #2862. --- BTCPayServer/Views/Apps/TemplateEditor.cshtml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Views/Apps/TemplateEditor.cshtml b/BTCPayServer/Views/Apps/TemplateEditor.cshtml index f285eec22..80c7a6606 100644 --- a/BTCPayServer/Views/Apps/TemplateEditor.cshtml +++ b/BTCPayServer/Views/Apps/TemplateEditor.cshtml @@ -340,8 +340,9 @@ document.addEventListener("DOMContentLoaded", function () { return this.errors.length === 0; }, saveEditingItem: function(){ - if(!this.editingItem.id){ - this.editingItem.id = this.editingItem.title.toLowerCase().trim(); + const fallbackId = this.editingItem.title.toLowerCase().trim(); + if(!this.editingItem.id && fallbackId){ + this.editingItem.id = fallbackId; this.$nextTick(this.saveEditingItem.bind(this)); return; }