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
15bd0353
Commit
15bd0353
authored
Apr 27, 2020
by
telami
Committed by
kl
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复:需求
https://gitee.com/kekingcn/file-online-preview/issues/I14D4X,当使用nginx做代理时,配…
修复:需求
https://gitee.com/kekingcn/file-online-preview/issues/I14D4X,当使用nginx做代理时,配置了content-path和baseUrl时,访问view.html和getCorsFile会出现404
parent
e0b1cd76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
viewer.js
...nverter-web/src/main/resources/static/pdfjs/web/viewer.js
+5
-3
pdf.ftl
jodconverter-web/src/main/resources/web/pdf.ftl
+1
-1
No files found.
jodconverter-web/src/main/resources/static/pdfjs/web/viewer.js
View file @
15bd0353
...
...
@@ -1886,7 +1886,7 @@ var PDFViewerApplication = {
var
validateFileURL
=
void
0
;
{
var
HOSTED_VIEWER_ORIGINS
=
[
'null'
,
'http://mozilla.github.io'
,
'https://mozilla.github.io'
];
validateFileURL
=
function
validateFileURL
(
file
)
{
validateFileURL
=
function
validateFileURL
(
file
,
base
)
{
if
(
file
===
undefined
)
{
return
file
;
}
...
...
@@ -1897,7 +1897,7 @@ var validateFileURL = void 0;
}
var
fileOrigin
=
new
URL
(
file
,
window
.
location
.
href
).
origin
;
if
(
fileOrigin
!==
viewerOrigin
)
{
return
'/
getCorsFile?urlPath='
+
encodeURIComponent
(
file
);
return
base
.
endsWith
(
'/'
)
?
base
:
'/'
+
'
getCorsFile?urlPath='
+
encodeURIComponent
(
file
);
}
}
catch
(
ex
)
{
var
message
=
ex
&&
ex
.
message
;
...
...
@@ -1931,10 +1931,12 @@ function loadAndEnablePDFBug(enabledTabs) {
function
webViewerInitialized
()
{
var
appConfig
=
PDFViewerApplication
.
appConfig
;
var
file
=
void
0
;
var
base
=
void
0
;
var
queryString
=
document
.
location
.
search
.
substring
(
1
);
var
params
=
(
0
,
_ui_utils
.
parseQueryString
)(
queryString
);
file
=
'file'
in
params
?
params
.
file
:
appConfig
.
defaultUrl
;
file
=
validateFileURL
(
file
);
base
=
'base'
in
params
?
params
.
base
:
appConfig
.
defaultUrl
;
file
=
validateFileURL
(
file
,
base
);
var
waitForBeforeOpening
=
[];
var
fileInput
=
document
.
createElement
(
'input'
);
fileInput
.
id
=
appConfig
.
openFileInputName
;
...
...
jodconverter-web/src/main/resources/web/pdf.ftl
View file @
15bd0353
...
...
@@ -28,7 +28,7 @@
</body>
<script
type=
"text/javascript"
>
document
.
getElementsByTagName
(
'iframe'
)[
0
].
src
=
"
/pdfjs/web/viewer.html?
file="
+
encodeURIComponent
(
'${finalUrl}'
);
document
.
getElementsByTagName
(
'iframe'
)[
0
].
src
=
"
${baseUrl}pdfjs/web/viewer.html?base=${baseUrl}&
file="
+
encodeURIComponent
(
'${finalUrl}'
);
document
.
getElementsByTagName
(
'iframe'
)[
0
].
height
=
document
.
documentElement
.
clientHeight
-
10
;
/**
* 页面变化调整高度
...
...
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