From 934537f0b9d290c8fe7eb28bcc83965129f07dd6 Mon Sep 17 00:00:00 2001 From: Niklas Fondberg Date: Fri, 10 Jun 2022 09:30:45 +0200 Subject: [PATCH] Return error when width or height are not set as integers (#61) --- api/resources/prices.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/resources/prices.py b/api/resources/prices.py index 3a5d564..78abd8a 100644 --- a/api/resources/prices.py +++ b/api/resources/prices.py @@ -1,7 +1,7 @@ from api.models.external_print_product import get_cheapest_canvas_product, get_cheapest_poster_product from flask import Blueprint, request, jsonify from api.helpers import check_api_key -from api.validators import validate_number, validate_exists +from api.validators import ValidationError, validate_number, validate_exists from api.models import ( Inquiry, Market, @@ -49,6 +49,9 @@ def wallpaper(): designer = get_designer() reseller = get_reseller() + if width is None or height is None: + raise ValidationError("width and height must be integers") + materials = Material.query.wallpapers().all() data = [] for material in materials: