File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 22# @Author : Lan
33# @File : storage.py
44# @Software: PyCharm
5+ import base64
56import hashlib
67from core .logger import logger
78import shutil
@@ -656,7 +657,6 @@ async def delete_file(self, file_code: FileCodes):
656657 """删除WebDAV文件及空目录"""
657658 file_path = await file_code .get_file_path ()
658659 url = self ._build_url (file_path )
659-
660660 try :
661661 async with aiohttp .ClientSession (auth = self .auth ) as session :
662662 # 删除文件
@@ -683,7 +683,9 @@ async def get_file_response(self, file_code: FileCodes):
683683 try :
684684 filename = file_code .prefix + file_code .suffix
685685 url = self ._build_url (await file_code .get_file_path ())
686- async with aiohttp .ClientSession (auth = self .auth ) as session :
686+ async with aiohttp .ClientSession (headers = {
687+ "Authorization" : f"Basic { base64 .b64encode (f'{ settings .webdav_username } :{ settings .webdav_password } ' .encode ()).decode ()} "
688+ }) as session :
687689 async with session .get (url ) as resp :
688690 if resp .status != 200 :
689691 raise HTTPException (
You can’t perform that action at this time.
0 commit comments