Browse Source

Update WxStorageController.java (#530)

解决litemallStorage有可能返回null值,会造成异常
zhanws 2 years ago
parent
commit
9f81d58ce0

+ 2 - 2
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxStorageController.java

@@ -66,7 +66,7 @@ public class WxStorageController {
     @GetMapping("/fetch/{key:.+}")
     public ResponseEntity<Resource> fetch(@PathVariable String key) {
         LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
-        if (key == null) {
+        if (litemallStorage==null||key == null) {
             return ResponseEntity.notFound().build();
         }
         if (key.contains("../")) {
@@ -91,7 +91,7 @@ public class WxStorageController {
     @GetMapping("/download/{key:.+}")
     public ResponseEntity<Resource> download(@PathVariable String key) {
         LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
-        if (key == null) {
+        if (litemallStorage==null||key == null) {
             return ResponseEntity.notFound().build();
         }
         if (key.contains("../")) {