Skip to content

Commit 9f81d58

Browse files
authored
Update WxStorageController.java (#530)
解决litemallStorage有可能返回null值,会造成异常
1 parent 5d144ee commit 9f81d58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Object upload(@RequestParam("file") MultipartFile file) throws IOExceptio
6666
@GetMapping("/fetch/{key:.+}")
6767
public ResponseEntity<Resource> fetch(@PathVariable String key) {
6868
LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
69-
if (key == null) {
69+
if (litemallStorage==null||key == null) {
7070
return ResponseEntity.notFound().build();
7171
}
7272
if (key.contains("../")) {
@@ -91,7 +91,7 @@ public ResponseEntity<Resource> fetch(@PathVariable String key) {
9191
@GetMapping("/download/{key:.+}")
9292
public ResponseEntity<Resource> download(@PathVariable String key) {
9393
LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
94-
if (key == null) {
94+
if (litemallStorage==null||key == null) {
9595
return ResponseEntity.notFound().build();
9696
}
9797
if (key.contains("../")) {

0 commit comments

Comments
 (0)