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
jenkins
slm-fileview
Commits
7a7e1a18
Commit
7a7e1a18
authored
Dec 27, 2020
by
chenkailing
Committed by
kl
Dec 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复导包错误以及图片预览bug
parent
f530f441
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
5 deletions
+7
-5
MarkdownFilePreviewImpl.java
.../java/cn/keking/service/impl/MarkdownFilePreviewImpl.java
+1
-1
PictureFilePreviewImpl.java
...n/java/cn/keking/service/impl/PictureFilePreviewImpl.java
+2
-2
SimTextFilePreviewImpl.java
...n/java/cn/keking/service/impl/SimTextFilePreviewImpl.java
+1
-1
XmlFilePreviewImpl.java
.../main/java/cn/keking/service/impl/XmlFilePreviewImpl.java
+1
-1
OnlinePreviewController.java
...ava/cn/keking/web/controller/OnlinePreviewController.java
+2
-0
No files found.
server/src/main/java/cn/keking/service/impl/MarkdownFilePreviewImpl.java
View file @
7a7e1a18
...
@@ -5,7 +5,7 @@ import cn.keking.service.FilePreview;
...
@@ -5,7 +5,7 @@ import cn.keking.service.FilePreview;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
static
c
om
.
sun
.
glass
.
ui
.
Clipboard
.
TEXT_TYPE
;
import
static
c
n
.
keking
.
service
.
impl
.
SimTextFilePreviewImpl
.
TEXT_TYPE
;
/**
/**
* @author kl (http://kailing.pub)
* @author kl (http://kailing.pub)
...
...
server/src/main/java/cn/keking/service/impl/PictureFilePreviewImpl.java
View file @
7a7e1a18
...
@@ -44,11 +44,11 @@ public class PictureFilePreviewImpl implements FilePreview {
...
@@ -44,11 +44,11 @@ public class PictureFilePreviewImpl implements FilePreview {
String
file
=
fileHandlerService
.
getRelativePath
(
response
.
getContent
());
String
file
=
fileHandlerService
.
getRelativePath
(
response
.
getContent
());
imgUrls
.
clear
();
imgUrls
.
clear
();
imgUrls
.
add
(
file
);
imgUrls
.
add
(
file
);
model
.
addAttribute
(
"img
u
rls"
,
imgUrls
);
model
.
addAttribute
(
"img
U
rls"
,
imgUrls
);
model
.
addAttribute
(
"currentUrl"
,
file
);
model
.
addAttribute
(
"currentUrl"
,
file
);
}
}
}
else
{
}
else
{
model
.
addAttribute
(
"img
u
rls"
,
imgUrls
);
model
.
addAttribute
(
"img
U
rls"
,
imgUrls
);
model
.
addAttribute
(
"currentUrl"
,
url
);
model
.
addAttribute
(
"currentUrl"
,
url
);
}
}
return
PICTURE_FILE_PREVIEW_PAGE
;
return
PICTURE_FILE_PREVIEW_PAGE
;
...
...
server/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java
View file @
7a7e1a18
...
@@ -39,7 +39,7 @@ public class SimTextFilePreviewImpl implements FilePreview {
...
@@ -39,7 +39,7 @@ public class SimTextFilePreviewImpl implements FilePreview {
try
{
try
{
File
originFile
=
new
File
(
response
.
getContent
());
File
originFile
=
new
File
(
response
.
getContent
());
String
xmlString
=
FileUtils
.
readFileToString
(
originFile
,
StandardCharsets
.
UTF_8
);
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
)
{
}
catch
(
IOException
e
)
{
return
otherFilePreview
.
notSupportedFile
(
model
,
fileAttribute
,
e
.
getLocalizedMessage
());
return
otherFilePreview
.
notSupportedFile
(
model
,
fileAttribute
,
e
.
getLocalizedMessage
());
}
}
...
...
server/src/main/java/cn/keking/service/impl/XmlFilePreviewImpl.java
View file @
7a7e1a18
...
@@ -5,7 +5,7 @@ import cn.keking.service.FilePreview;
...
@@ -5,7 +5,7 @@ import cn.keking.service.FilePreview;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
static
c
om
.
sun
.
glass
.
ui
.
Clipboard
.
TEXT_TYPE
;
import
static
c
n
.
keking
.
service
.
impl
.
SimTextFilePreviewImpl
.
TEXT_TYPE
;
/**
/**
* @author kl (http://kailing.pub)
* @author kl (http://kailing.pub)
...
...
server/src/main/java/cn/keking/web/controller/OnlinePreviewController.java
View file @
7a7e1a18
...
@@ -65,6 +65,8 @@ public class OnlinePreviewController {
...
@@ -65,6 +65,8 @@ public class OnlinePreviewController {
if
(
StringUtils
.
hasText
(
currentUrl
)){
if
(
StringUtils
.
hasText
(
currentUrl
)){
String
decodedCurrentUrl
=
new
String
(
Base64Utils
.
decodeFromString
(
currentUrl
));
String
decodedCurrentUrl
=
new
String
(
Base64Utils
.
decodeFromString
(
currentUrl
));
model
.
addAttribute
(
"currentUrl"
,
decodedCurrentUrl
);
model
.
addAttribute
(
"currentUrl"
,
decodedCurrentUrl
);
}
else
{
model
.
addAttribute
(
"currentUrl"
,
imgUrls
.
get
(
0
));
}
}
return
PICTURE_FILE_PREVIEW_PAGE
;
return
PICTURE_FILE_PREVIEW_PAGE
;
}
}
...
...
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