This commit is contained in:
yumoqing 2026-04-09 08:16:18 +08:00
parent a2dfc23666
commit 5c1c75df0f

View File

@ -228,18 +228,18 @@ async def base642file(b64str):
return fpath return fpath
async def b64media2url(request, mediafile): async def b64media2url(request, mediafile):
# env = request._run_ns # env = request._run_ns
# entire_url = env.entire_url # entire_url = env.entire_url
if mediafile.startswith('http://') or mediafile.startswith('https://'): if mediafile.startswith('http://') or mediafile.startswith('https://'):
return mediafile return mediafile
webpath = mediafile webpath = mediafile
if mediafile.startswith('data:'): if mediafile.startswith('data:'):
fpath = await base642file(mediafile) fpath = await base642file(mediafile)
webpath = FileStorage().webpath(fpath) webpath = FileStorage().webpath(fpath)
elif len(mediafile) > 8000: elif len(mediafile) > 8000:
e = Exception(f'mediafile is not a media file') e = Exception(f'mediafile is not a media file')
exception(f'{e}') exception(f'{e}')
return '' return ''
if request: if request:
url = entire_url('/idfile?path=') + quote(webpath) url = entire_url('/idfile?path=') + quote(webpath)
return url return url