修复发布节点到市场时文件URL是相对地址的问题
This commit is contained in:
parent
55fae1bd17
commit
f788a9948d
@ -12,6 +12,7 @@ import requests
|
||||
from jingrow.utils.fs import atomic_write_json
|
||||
from jingrow.utils.jingrow_api import get_record_id, create_record, update_record, get_record_list
|
||||
from jingrow.utils.auth import get_jingrow_cloud_url, get_jingrow_cloud_api_headers
|
||||
from jingrow.config import Config
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -674,6 +675,18 @@ async def publish_node_to_marketplace(
|
||||
发布节点到Jingrow Cloud节点市场
|
||||
"""
|
||||
try:
|
||||
# 如果file_url不是绝对地址,拼接完整的服务器地址
|
||||
if file_url and not file_url.startswith('http://') and not file_url.startswith('https://'):
|
||||
# 确保URL以 / 开头
|
||||
if not file_url.startswith('/'):
|
||||
file_url = '/' + file_url
|
||||
|
||||
# 使用Config中的服务器URL,如果没有则尝试从请求获取
|
||||
server_url = Config.jingrow_server_url
|
||||
# 确保服务器URL不以 / 结尾
|
||||
server_url = server_url.rstrip('/')
|
||||
file_url = f"{server_url}{file_url}"
|
||||
|
||||
url = f"{get_jingrow_cloud_url()}/api/action/jcloud.api.jlocal.create_local_node"
|
||||
|
||||
headers = get_jingrow_cloud_api_headers()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user