Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
梁杰芳
slm-fileview
Commits
b1fdbd26
Commit
b1fdbd26
authored
Oct 25, 2019
by
陈精华
Committed by
kl
Oct 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新功能点:全部能识别的纯文本直接预览,不用再转跳下载(.md、.java、.py等浏览器不认识的后缀名)
parent
fa7241bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
SimTextFilePreviewImpl.java
...n/java/cn/keking/service/impl/SimTextFilePreviewImpl.java
+14
-1
No files found.
jodconverter-web/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java
View file @
b1fdbd26
...
...
@@ -9,6 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
/**
* Created by kl on 2018/1/17.
* Content :处理文本文件
...
...
@@ -32,7 +36,16 @@ public class SimTextFilePreviewImpl implements FilePreview{
model
.
addAttribute
(
"fileType"
,
fileAttribute
.
getSuffix
());
return
"fileNotSupported"
;
}
model
.
addAttribute
(
"ordinaryUrl"
,
response
.
getMsg
());
try
{
File
originFile
=
new
File
(
response
.
getContent
());
File
previewFile
=
new
File
(
response
.
getContent
()
+
".txt"
);
Files
.
copy
(
originFile
.
toPath
(),
previewFile
.
toPath
());
}
catch
(
IOException
e
)
{
model
.
addAttribute
(
"msg"
,
e
.
getLocalizedMessage
());
model
.
addAttribute
(
"fileType"
,
fileAttribute
.
getSuffix
());
return
"fileNotSupported"
;
}
model
.
addAttribute
(
"ordinaryUrl"
,
response
.
getMsg
()
+
".txt"
);
return
"txt"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment