File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 2
2
# @Author : Lan
3
3
# @File : storage.py
4
4
# @Software: PyCharm
5
+ import base64
5
6
import hashlib
6
7
from core .logger import logger
7
8
import shutil
@@ -656,7 +657,6 @@ async def delete_file(self, file_code: FileCodes):
656
657
"""删除WebDAV文件及空目录"""
657
658
file_path = await file_code .get_file_path ()
658
659
url = self ._build_url (file_path )
659
-
660
660
try :
661
661
async with aiohttp .ClientSession (auth = self .auth ) as session :
662
662
# 删除文件
@@ -683,7 +683,9 @@ async def get_file_response(self, file_code: FileCodes):
683
683
try :
684
684
filename = file_code .prefix + file_code .suffix
685
685
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 :
687
689
async with session .get (url ) as resp :
688
690
if resp .status != 200 :
689
691
raise HTTPException (
You can’t perform that action at this time.
0 commit comments