edit prefix
This commit is contained in:
parent
8cb9121a7f
commit
f79db81a59
1 changed files with 2 additions and 2 deletions
4
main.py
4
main.py
|
|
@ -23,7 +23,7 @@ BASE_DIR = Path("/usr/src/app/taobin_project")
|
||||||
# BASE_DIR = Path("/taobin_project")
|
# BASE_DIR = Path("/taobin_project")
|
||||||
|
|
||||||
SERVICE_NAME = os.getenv("SERVICE_NAME")
|
SERVICE_NAME = os.getenv("SERVICE_NAME")
|
||||||
PREFIX = os.getenv("PREFIX", "")
|
PREFIX = os.getenv("PREFIX", "/taobin-image")
|
||||||
|
|
||||||
GIT_REPO_SERVER_URL = os.getenv("GIT_REPO_SERVER_URL")
|
GIT_REPO_SERVER_URL = os.getenv("GIT_REPO_SERVER_URL")
|
||||||
FRONTEND_NOTIFY_URL = os.getenv("FRONTEND_NOTIFY_URL")
|
FRONTEND_NOTIFY_URL = os.getenv("FRONTEND_NOTIFY_URL")
|
||||||
|
|
@ -44,7 +44,7 @@ ALLOWED_EXTENSIONS = {".jpg", ".jpeg", ".png", ".gif", ".webp"}
|
||||||
async def strip_prefix_middleware(request: Request, call_next):
|
async def strip_prefix_middleware(request: Request, call_next):
|
||||||
path = request.scope["path"]
|
path = request.scope["path"]
|
||||||
|
|
||||||
if path.startswith(PREFIX):
|
if PREFIX and path.startswith(PREFIX):
|
||||||
new_path = path[len(PREFIX):]
|
new_path = path[len(PREFIX):]
|
||||||
|
|
||||||
if not new_path:
|
if not new_path:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue