Browse Source

base64移除换行

drew 6 years ago
parent
commit
9a55aabb87
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/main/java/com/izouma/dingdong/web/FileUploadController.java

+ 1 - 0
src/main/java/com/izouma/dingdong/web/FileUploadController.java

@@ -55,6 +55,7 @@ public class FileUploadController {
     @PostMapping("/base64")
     @PostMapping("/base64")
     public String uploadImage(@RequestParam("base64") String base64,
     public String uploadImage(@RequestParam("base64") String base64,
                               @RequestParam(value = "path", required = false) String path) {
                               @RequestParam(value = "path", required = false) String path) {
+        base64 = base64.replace("\n","");
         base64 = base64.substring(base64.indexOf(',') + 1);
         base64 = base64.substring(base64.indexOf(',') + 1);
         Base64.Decoder decoder = Base64.getDecoder();
         Base64.Decoder decoder = Base64.getDecoder();
         if (path == null) {
         if (path == null) {