From f0da36801faaacb8973af26dc92ab458caad8d01 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 28 Jul 2025 00:04:54 -0400 Subject: [PATCH] Fix docs links with URL prefix --- libretranslate/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libretranslate/app.py b/libretranslate/app.py index 77961f0..e0381e5 100644 --- a/libretranslate/app.py +++ b/libretranslate/app.py @@ -189,7 +189,7 @@ def create_app(args): from libretranslate.language import load_languages - swagger_url = "/docs" # Swagger UI (w/o trailing '/') + swagger_url = args.url_prefix + "/docs" # Swagger UI (w/o trailing '/') api_url = "/spec" bp = Blueprint('Main app', __name__) @@ -1301,8 +1301,8 @@ def create_app(args): # Call factory function to create our blueprint # The Blueprint is not using url_for which means the middleware does not work properly and we need to manually fix things - swaggerui_blueprint = get_swaggerui_blueprint(args.url_prefix + swagger_url, args.url_prefix + api_url) - swaggerui_blueprint.url_prefix = swagger_url + swaggerui_blueprint = get_swaggerui_blueprint(swagger_url, args.url_prefix + api_url) + swaggerui_blueprint.url_prefix = "/docs" app.register_blueprint(swaggerui_blueprint) return app