From bbf526f99febd4b6e3cfc70242205791e63f15e4 Mon Sep 17 00:00:00 2001 From: Tina_Azure <-> Date: Mon, 15 May 2023 19:30:48 +0200 Subject: [PATCH] minor fix to avoid the creation of '' templates since crow is incapable of routing those to / while trying to route them to / leading to a 404 obviously it's also possible to just give a general you have to name your template directive but as it stands i don't really see a need for it --- setupdb.sh | 2 +- src/main.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setupdb.sh b/setupdb.sh index 23d3505..29f2eef 100644 --- a/setupdb.sh +++ b/setupdb.sh @@ -39,7 +39,7 @@ sudo -u postgres psql -c "CREATE TABLE freelancers( sudo -u postgres psql -c "CREATE TABLE templates( id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, freelancerID int, - name text, + name text NOT NULL, content text, contactData text, contactInformation text, diff --git a/src/main.cpp b/src/main.cpp index a5a1f21..63b7ba7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -699,7 +699,8 @@ int main(int argc, char *argv[]) { if (splitItem.at(0) == "templatepriceondeliver") priceondeliver = splitItem.at(1); } - + if (name.empty()) + name = "unnamed"; if (!Utilities::checkIfStrIsNumber(priceupfront)) priceupfront = "0"; if (!Utilities::checkIfStrIsNumber(priceondeliver))