浏览代码

优化粤政图代理

baoyubo 8 月之前
父节点
当前提交
6f3c495c26
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      routers/api/OneShareProxyHandler/__init__.py

+ 2 - 1
routers/api/OneShareProxyHandler/__init__.py

@@ -180,7 +180,8 @@ async def mine(request: Request,body = Depends(remove_xss_json),db: Session = De
 
         return Response(content=response.text, media_type='application/html',status_code=response.status_code)
     elif 'image/png' in content_type:
-        cache[cache_key] = response
+        if response.status_code==200:
+            cache[cache_key] = response
         return StreamingResponse(content=io.BytesIO(response.content), media_type='image/png')
     # 可以继续添加更多的条件分支来处理其他类型
     else: