fix(page): fix AddPage not checking if the template actually existed.

This commit is contained in:
2026-05-27 23:07:08 +02:00
parent ae65322aa0
commit 664ae1f7d3
3 changed files with 32 additions and 7 deletions
+12
View File
@@ -2,6 +2,7 @@ package actions
import (
"bytes"
"errors"
"fmt"
"io"
"log"
@@ -15,6 +16,17 @@ import (
const FILEFORMAT string = "%s-%d"
func AddPage(id string, svgbuf []byte) (svg.TemplatePage, error) {
exists, err := database.Exists(id)
if err != nil {
return svg.TemplatePage{}, err
}
if !exists {
return svg.TemplatePage{}, errors.New("Template does not exist.")
}
data := svg.TemplatePage{TemplateId: id}
populateKeys(&data, svgbuf)