This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
be075016
Commit
be075016
authored
2 years ago
by
Michael Breu
Browse files
Options
Downloads
Patches
Plain Diff
Fixing slash encode problems
parent
c15c8382
2 merge requests
!132
Bringing July Release to production
,
!128
Fixing #315 and #319
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/webapp/app/exercise/service/exercise.service.ts
+11
-2
11 additions, 2 deletions
src/main/webapp/app/exercise/service/exercise.service.ts
with
11 additions
and
2 deletions
src/main/webapp/app/exercise/service/exercise.service.ts
+
11
−
2
View file @
be075016
...
...
@@ -13,7 +13,7 @@ import { Observable } from 'rxjs';
@
Injectable
({
providedIn
:
'
root
'
})
export
class
ExerciseService
{
public
resourceUrl
=
this
.
applicationConfigService
.
getEndpointFor
(
'
api/exerciseFile/
'
);
public
exerciseUrl
=
this
.
applicationConfigService
.
getEndpointFor
(
'
api/exercise/
'
);
public
exerciseUrl
:
string
=
this
.
applicationConfigService
.
getEndpointFor
(
'
api/exercise/
'
);
constructor
(
private
http
:
HttpClient
,
...
...
@@ -36,9 +36,18 @@ export class ExerciseService {
}
public
loadExercise
(
exerciseId
:
string
):
Observable
<
SearchResultDTO
>
{
return
this
.
http
.
get
<
SearchResultDTO
>
(
this
.
exerciseUrl
+
encodeURI
Component
(
exerciseId
));
return
this
.
http
.
get
<
SearchResultDTO
>
(
this
.
exerciseUrl
+
this
.
encodeURI
forExerciseId
(
exerciseId
));
}
/*
* behind the apache reverse proxy, encoded slashes are not working.
* I have not found a good way to repair this. So we unencode the slashes here.
*/
private
encodeURIforExerciseId
(
exerciseId
:
string
):
string
{
const
encodedURL
=
encodeURIComponent
(
exerciseId
);
return
encodedURL
.
replace
(
"
%2F
"
,
"
/
"
).
replace
(
"
%2f
"
,
"
/
"
)
}
populateExerciseWithData
(
exercise
:
Exercise
):
Exercise
{
if
(
exercise
!==
undefined
)
{
exercise
.
views
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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