Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
575d2077
Commit
575d2077
authored
5 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-4453: fix substring of url in single page
parent
b6553c82
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
+5
-9
5 additions, 9 deletions
...e/gui/control/generic/iframe/IFrameDisplayController.java
with
5 additions
and
9 deletions
src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
+
5
−
9
View file @
575d2077
...
@@ -336,28 +336,25 @@ public class IFrameDisplayController extends BasicController implements GenericE
...
@@ -336,28 +336,25 @@ public class IFrameDisplayController extends BasicController implements GenericE
setPageDownload
(
isPageDownloadAllowed
(
currentUri
));
setPageDownload
(
isPageDownloadAllowed
(
currentUri
));
}
}
private
boolean
isPageDownloadAllowed
(
String
uri
)
{
private
boolean
isPageDownloadAllowed
(
final
String
uri
)
{
if
(!
allowDownload
||
!
StringHelper
.
containsNonWhitespace
(
uri
))
{
if
(!
allowDownload
||
!
StringHelper
.
containsNonWhitespace
(
uri
))
{
return
false
;
return
false
;
}
}
// remove any URL parameters
// remove any URL parameters
String
uriLc
=
uri
.
toLowerCase
();
String
uriLc
=
uri
.
toLowerCase
();
int
qmarkPos
=
uriLc
.
indexOf
(
"?"
);
int
qmarkPos
=
uriLc
.
indexOf
(
'?'
);
if
(
qmarkPos
!=
-
1
)
{
if
(
qmarkPos
!=
-
1
)
{
// e.g. index.html?olatraw=true
// e.g. index.html?olatraw=true
uriLc
=
uriLc
.
substring
(
0
,
qmarkPos
);
uriLc
=
uriLc
.
substring
(
0
,
qmarkPos
);
}
}
// remove any anchor references
// remove any anchor references
int
hTagPos
=
uri
.
indexOf
(
"#"
);
int
hTagPos
=
uri
Lc
.
indexOf
(
'#'
);
if
(
hTagPos
!=
-
1
)
{
if
(
hTagPos
!=
-
1
)
{
// e.g. index.html#checkThisOut
// e.g. index.html#checkThisOut
uriLc
=
uriLc
.
substring
(
0
,
hTagPos
);
uriLc
=
uriLc
.
substring
(
0
,
hTagPos
);
}
}
// HTML pages are rendered inline, everything else is regarded as "downloadable"
// HTML pages are rendered inline, everything else is regarded as "downloadable"
if
(
uriLc
.
endsWith
(
".html"
)
||
uriLc
.
endsWith
(
".htm"
)
||
uriLc
.
endsWith
(
".xhtml"
))
{
return
!
uriLc
.
endsWith
(
".html"
)
&&
!
uriLc
.
endsWith
(
".htm"
)
&&
!
uriLc
.
endsWith
(
".xhtml"
);
return
false
;
}
return
true
;
}
}
private
void
setPageDownload
(
boolean
allow
)
{
private
void
setPageDownload
(
boolean
allow
)
{
...
@@ -385,8 +382,7 @@ public class IFrameDisplayController extends BasicController implements GenericE
...
@@ -385,8 +382,7 @@ public class IFrameDisplayController extends BasicController implements GenericE
if
(
NEW_URI_EVENT
.
equals
(
event
.
getCommand
()))
{
if
(
NEW_URI_EVENT
.
equals
(
event
.
getCommand
()))
{
// This event gets triggered from the iframe content by calling a js function outside
// This event gets triggered from the iframe content by calling a js function outside
// Get new uri from JS method and fire to parents
// Get new uri from JS method and fire to parents
String
newUri
=
ureq
.
getModuleURI
();
String
newUri
=
ureq
.
getHttpReq
().
getParameter
(
"uri"
);
newUri
=
ureq
.
getHttpReq
().
getParameter
(
"uri"
);
int
baseUriPos
=
newUri
.
indexOf
(
baseURI
);
int
baseUriPos
=
newUri
.
indexOf
(
baseURI
);
if
(
baseUriPos
!=
-
1
)
{
if
(
baseUriPos
!=
-
1
)
{
int
newUriPos
=
baseUriPos
+
baseURI
.
length
();
int
newUriPos
=
baseUriPos
+
baseURI
.
length
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment