From: Enju Aihara <9839590-EnjuAihara@users.noreply.gitlab.com> Date: Fri, 22 Apr 2022 18:42:39 +0000 (+0200) Subject: fixed bug when domain is empty X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=80b9cba5f336db28d12bd5c97ba485f0d1102135;p=fba.git fixed bug when domain is empty --- diff --git a/api.py b/api.py index 20363b9..0090f62 100644 --- a/api.py +++ b/api.py @@ -1,4 +1,4 @@ -from fastapi import FastAPI, Request, HTTPException +from fastapi import FastAPI, Request, HTTPException, responses import sqlite3 from hashlib import sha256 from fastapi.templating import Jinja2Templates @@ -55,6 +55,8 @@ def blocked(domain: str = None): @app.get(base_url+"/") def index(request: Request, domain: str = None): + if domain == "": + return responses.RedirectResponse("/") blocks = get(f"http://127.0.0.1:8069{base_url}/api?domain={domain}") info = None if domain == None: diff --git a/index.html b/index.html index 607ca73..05c4091 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,6 @@ - fedi-block-api {{domain}} + fedi-block-api{% if domain %} {{domain}}{% endif %}