浏览代码

update oss-store ObjectGetController

reghao 1 年之前
父节点
当前提交
0dddc46921
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      oss-store/src/main/java/cn/reghao/oss/store/controller/ObjectGetController.java

+ 6 - 0
oss-store/src/main/java/cn/reghao/oss/store/controller/ObjectGetController.java

@@ -80,6 +80,12 @@ public class ObjectGetController {
         }
 
         String secretKey = cache.getIfPresent(token);
+        if (secretKey == null) {
+            String payload = "secretKey not found";
+            getObjectService.writeResponse(HttpServletResponse.SC_FORBIDDEN, payload);
+            return;
+        }
+
         String queryString = String.format("token=%s&t=%s&nonce=%s", token, timestamp, nonce);
         String host = ServletUtil.getHeader("host");
         String url = String.format("//%s/%s", host, objectName);