@@ -96,11 +96,9 @@ async def measure(self, size: int) -> str:
9696 response = await session .post ("/api/fs/get" , json = {"path" : file_path , "password" : self .password })
9797 response .raise_for_status ()
9898 data = await response .json ()
99- logger .debug (data )
10099 if data ["code" ] == 200 :
101100 return data ["data" ]["raw_url" ]
102101 if data ["code" ] != 200 :
103- logger .debug (2 )
104102 try :
105103 buffer = b"\x00 \x66 \xcc \xff " * 256 * 1024 * size
106104 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:
115113 response = await session .post ("/api/fs/get" , json = {"path" : file_path , "password" : self .password })
116114 response .raise_for_status ()
117115 data = await response .json ()
118- logger .debug (data )
119- logger .debug (3 )
120116 return data ["data" ]["raw_url" ]
121117 except Exception as e :
122118 logger .terror ("storage.error.alist.measure" , e = e )
123- return
119+ return ""
124120
125121 async def express (self , hash : str , request : web .Request , response ) -> Dict [str , Any ]:
126122 path = f"{ self .path } /{ hash [:2 ]} /{ hash } "
@@ -137,7 +133,7 @@ async def express(self, hash: str, request: web.Request, response) -> Dict[str,
137133 await response .prepare (request )
138134 return {"bytes" : data ["data" ]["size" ], "hits" : 1 }
139135 except Exception as e :
140- response = web .HTTPInternalServerError ( reason = e )
136+ response = web .HTTPError ( text = e )
141137 await response .prepare (request )
142138 logger .debug (e )
143139 return {"bytes" : 0 , "hits" : 0 }
0 commit comments