Skip to content

Commit 4b78019

Browse files
Vinceeeedengyh
authored andcommitted
fix: 修复本地开发时候的报错
1 parent cabd8b8 commit 4b78019

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • runtime/bk-plugin-runtime/bk_plugin_runtime/config

runtime/bk-plugin-runtime/bk_plugin_runtime/config/default.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,12 @@ def logging_addition_settings(logging_dict):
256256
# analysis the app environment and address via bkpaas env vars
257257
bkpaas_default_preallocated_urls = json.loads(os.getenv("BKPAAS_DEFAULT_PREALLOCATED_URLS", "{}"))
258258
bkpaas_environment = os.getenv("BKPAAS_ENVIRONMENT", "dev")
259-
app_address = bkpaas_default_preallocated_urls.get(bkpaas_environment)
259+
app_address = bkpaas_default_preallocated_urls.get(bkpaas_environment) or ""
260260
parsed_url = urlparse(app_address)
261261
app_scheme = parsed_url.scheme
262262
app_domain = parsed_url.netloc
263-
app_subpath = parsed_url.path.rstrip("/")
263+
_path = parsed_url.path
264+
app_subpath = (_path.decode("utf-8") if isinstance(_path, bytes) else _path).rstrip("/")
264265

265266
BK_APIGW_STAGE_BACKEND_HOST = f"{app_scheme}://{app_domain}"
266267
BK_APIGW_STAGE_BACKEND_SUBPATH = app_subpath
@@ -295,7 +296,8 @@ def logging_addition_settings(logging_dict):
295296
)
296297
url_parse = urllib.parse.urlparse(BK_PLUGIN_APIGW_BACKEND_HOST)
297298
BK_PLUGIN_APIGW_BACKEND_NETLOC = url_parse.netloc
298-
BK_PLUGIN_APIGW_BACKEND_SUB_PATH = url_parse.path.lstrip("/")
299+
_path = url_parse.path
300+
BK_PLUGIN_APIGW_BACKEND_SUB_PATH = (_path.decode("utf-8") if isinstance(_path, bytes) else _path).lstrip("/")
299301
BK_PLUGIN_APIGW_BACKEND_SCHEME = url_parse.scheme or "http"
300302

301303
BK_APIGW_CORS_ALLOW_ORIGINS = os.getenv("BK_APIGW_CORS_ALLOW_ORIGINS", "")

0 commit comments

Comments
 (0)