Skip to content

Commit

Permalink
修复导包错误以及图片预览bug
Browse files Browse the repository at this point in the history
  • Loading branch information
klboke committed Dec 27, 2020
1 parent f530f44 commit 7a7e1a1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import static com.sun.glass.ui.Clipboard.TEXT_TYPE;
import static cn.keking.service.impl.SimTextFilePreviewImpl.TEXT_TYPE;

/**
* @author kl (http://kailing.pub)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public String filePreviewHandle(String url, Model model, FileAttribute fileAttri
String file = fileHandlerService.getRelativePath(response.getContent());
imgUrls.clear();
imgUrls.add(file);
model.addAttribute("imgurls", imgUrls);
model.addAttribute("imgUrls", imgUrls);
model.addAttribute("currentUrl", file);
}
} else {
model.addAttribute("imgurls", imgUrls);
model.addAttribute("imgUrls", imgUrls);
model.addAttribute("currentUrl", url);
}
return PICTURE_FILE_PREVIEW_PAGE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public String filePreviewHandle(String url, Model model, FileAttribute fileAttri
try {
File originFile = new File(response.getContent());
String xmlString = FileUtils.readFileToString(originFile, StandardCharsets.UTF_8);
model.addAttribute("textData", Base64Utils.encodeToString(xmlString.getBytes()));
model.addAttribute("textData", Base64Utils.encodeToString(xmlString.getBytes(StandardCharsets.UTF_8)));
} catch (IOException e) {
return otherFilePreview.notSupportedFile(model, fileAttribute, e.getLocalizedMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import static com.sun.glass.ui.Clipboard.TEXT_TYPE;
import static cn.keking.service.impl.SimTextFilePreviewImpl.TEXT_TYPE;

/**
* @author kl (http://kailing.pub)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public String picturesPreview(String urls, Model model, HttpServletRequest req)
if(StringUtils.hasText(currentUrl)){
String decodedCurrentUrl = new String(Base64Utils.decodeFromString(currentUrl));
model.addAttribute("currentUrl", decodedCurrentUrl);
}else {
model.addAttribute("currentUrl", imgUrls.get(0));
}
return PICTURE_FILE_PREVIEW_PAGE;
}
Expand Down

0 comments on commit 7a7e1a1

Please sign in to comment.