From 90b366bd7a5e033b312d2de33b590da12c8f9f9d Mon Sep 17 00:00:00 2001 From: Yarne Coppens Date: Sun, 29 Sep 2024 16:56:01 +0200 Subject: [PATCH] Fixed route for new icon structure --- src/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index 645c48e..01c248f 100644 --- a/src/main.py +++ b/src/main.py @@ -64,9 +64,9 @@ def get_all_products(): def get_single_product(barcode: int): return data_connection.get_single_product(barcode) -@app.get("/icons/{icon_filename}", response_class=FileResponse) -def get_icon(icon_filename: str): - full_filepath = os.path.join(definitions.ICONS_PATH, icon_filename) + ".svg" +@app.get("/icons/{icon_category}/{icon_filename}", response_class=FileResponse) +def get_icon(icon_category: str, icon_filename: str): + full_filepath = os.path.join(definitions.ICONS_PATH, icon_category, icon_filename) + ".svg" assert os.path.exists(full_filepath), f"File {full_filepath} not found" assert image_validator.is_valid_svg(file_name=full_filepath), f"File {full_filepath} is not a valid image"