@@ -96,11 +96,9 @@ async def measure(self, size: int) -> str:
96
96
response = await session .post ("/api/fs/get" , json = {"path" : file_path , "password" : self .password })
97
97
response .raise_for_status ()
98
98
data = await response .json ()
99
- logger .debug (data )
100
99
if data ["code" ] == 200 :
101
100
return data ["data" ]["raw_url" ]
102
101
if data ["code" ] != 200 :
103
- logger .debug (2 )
104
102
try :
105
103
buffer = b"\x00 \x66 \xcc \xff " * 256 * 1024 * size
106
104
response = await session .put ("/api/fs/put" , data = buffer , headers = {** self .headers , "File-Path" : file_path , "Content-Type" : "application/octet-stream" , "Content-Length" : str (size * 1024 * 1024 )})
@@ -115,12 +113,10 @@ async def measure(self, size: int) -> str:
115
113
response = await session .post ("/api/fs/get" , json = {"path" : file_path , "password" : self .password })
116
114
response .raise_for_status ()
117
115
data = await response .json ()
118
- logger .debug (data )
119
- logger .debug (3 )
120
116
return data ["data" ]["raw_url" ]
121
117
except Exception as e :
122
118
logger .terror ("storage.error.alist.measure" , e = e )
123
- return
119
+ return ""
124
120
125
121
async def express (self , hash : str , request : web .Request , response ) -> Dict [str , Any ]:
126
122
path = f"{ self .path } /{ hash [:2 ]} /{ hash } "
@@ -137,7 +133,7 @@ async def express(self, hash: str, request: web.Request, response) -> Dict[str,
137
133
await response .prepare (request )
138
134
return {"bytes" : data ["data" ]["size" ], "hits" : 1 }
139
135
except Exception as e :
140
- response = web .HTTPInternalServerError ( reason = e )
136
+ response = web .HTTPError ( text = e )
141
137
await response .prepare (request )
142
138
logger .debug (e )
143
139
return {"bytes" : 0 , "hits" : 0 }
0 commit comments