From 4a83e14a52a380354afefebd8c0430d962c9da41 Mon Sep 17 00:00:00 2001 From: Craig <121510295+CragglesG@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:48:26 +0000 Subject: [PATCH] Fixed bugs --- README.md | 2 +- main.py | 5 ++++- urls.json | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c4bc70..13bb2cd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Craig's Custom URL Shortener -A simple, versatile URL shortener with a web interface and API. It currently supports short links in the format go.craigg.dev/[tag]/[slug] (tag is optional), although support for more domains will be added soon. +A simple, versatile URL shortener with a web interface and API. It currently supports short links in the format go.craigg.dev/[slug], although support for more domains will be added soon. diff --git a/main.py b/main.py index 9c12b08..695f6f4 100644 --- a/main.py +++ b/main.py @@ -36,7 +36,10 @@ async def slug_only(slug: str): if slug == "favicon.ico": return HTTPException(404) else: - return RedirectResponse(urls["public"][slug]) + if slug in urls["public"].keys(): + return RedirectResponse(urls["public"][slug]) + else: + return RedirectResponse("/") if __name__ == "__main__": import uvicorn diff --git a/urls.json b/urls.json index 7ab911a..466da11 100644 --- a/urls.json +++ b/urls.json @@ -5,6 +5,7 @@ "public": { "hc": "https://hackclub.com", "portfolio": "https://craigg.dev", + "slack-summarizer ": "https://crates.io/crates/slack-summarizer", "url-shortener": "https://go.craigg.dev" } } \ No newline at end of file