This commit is contained in:
yumoqing 2026-07-14 13:38:38 +08:00
parent 3394b6ac06
commit 1198597766

View File

@ -210,12 +210,12 @@ async def downloadfile2url(request, url, headers=None, params=None, data={}, met
webpath = fs.webpath(fpath)
if request:
env = request._run_ns
url = env.entire_url('/idfile?path=') + env.quote(webpath)
url = env.entire_url('/download') + env.quote(webpath)
return url
baseurl = get_baseurl()
if baseurl:
return f'{baseurl}/idfile?path={quote(webpath)}'
return f'/idfile?path={quote(webpath)}'
return f'{baseurl}/download{quote(webpath)}'
return f'/download{quote(webpath)}'
def get_baseurl():
# 优先级BASEURL显式配置多域名部署用 > _LAST_BASEURL自动推导单域名场景
@ -248,10 +248,10 @@ async def b64media2url(request, mediafile):
return ''
if request:
entire_url = request._run_ns.entire_url
url = entire_url('/idfile?path=') + quote(webpath)
url = entire_url('/download') + quote(webpath)
return url
baseurl = get_baseurl()
if baseurl:
return f'{baseurl}/idfile?path={quote(mediafile)}'
return f'/idfile?path={quote(mediafile)}'
return f'{baseurl}/download{quote(mediafile)}'
return f'/downlaod{quote(mediafile)}'