diff --git a/server/src/main/java/cn/keking/service/impl/MarkdownFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/MarkdownFilePreviewImpl.java index 4f3d6771..b1a4fbcf 100644 --- a/server/src/main/java/cn/keking/service/impl/MarkdownFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/MarkdownFilePreviewImpl.java @@ -5,7 +5,7 @@ import cn.keking.service.FilePreview; 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) diff --git a/server/src/main/java/cn/keking/service/impl/PictureFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/PictureFilePreviewImpl.java index d8361f59..55fee06f 100644 --- a/server/src/main/java/cn/keking/service/impl/PictureFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/PictureFilePreviewImpl.java @@ -44,11 +44,11 @@ public class PictureFilePreviewImpl implements FilePreview { 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; diff --git a/server/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java index 06cdb896..a89232f5 100644 --- a/server/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java @@ -39,7 +39,7 @@ public class SimTextFilePreviewImpl implements FilePreview { 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()); } diff --git a/server/src/main/java/cn/keking/service/impl/XmlFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/XmlFilePreviewImpl.java index 7b7092ae..068849fd 100644 --- a/server/src/main/java/cn/keking/service/impl/XmlFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/XmlFilePreviewImpl.java @@ -5,7 +5,7 @@ import cn.keking.service.FilePreview; 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) diff --git a/server/src/main/java/cn/keking/web/controller/OnlinePreviewController.java b/server/src/main/java/cn/keking/web/controller/OnlinePreviewController.java index 52bd4d91..3198ac1f 100644 --- a/server/src/main/java/cn/keking/web/controller/OnlinePreviewController.java +++ b/server/src/main/java/cn/keking/web/controller/OnlinePreviewController.java @@ -65,6 +65,8 @@ public class OnlinePreviewController { 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; }