Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Car Share
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
LOISIL Paul
Car Share
Commits
47bf1d19
Commit
47bf1d19
authored
2 years ago
by
FurWaz
Browse files
Options
Downloads
Patches
Plain Diff
Fixed weird non-xss injection problem modifications
parent
4559bff9
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/frontend/src/views/TripsNew.vue
+17
-4
17 additions, 4 deletions
src/frontend/src/views/TripsNew.vue
with
17 additions
and
4 deletions
src/frontend/src/views/TripsNew.vue
+
17
−
4
View file @
47bf1d19
...
...
@@ -558,7 +558,14 @@ export default {
if
(
!
data
)
return
false
;
let
startDate
=
""
;
const
stylize
=
str
=>
`<span class="text-slate-600 dark:text-slate-200 font-bold">
${
str
}
</span>`
;
const
stylize
=
str
=>
{
if
(
!
str
)
return
""
;
const
span
=
document
.
createElement
(
"
span
"
);
span
.
classList
.
add
(
"
text-slate-600
"
,
"
dark:text-slate-200
"
,
"
font-bold
"
);
span
.
innerText
=
str
;
return
span
.
outerHTML
;
};
const
getDate
=
date
=>
{
if
(
!
date
)
return
undefined
;
const
strDate
=
new
Date
(
date
).
toLocaleDateString
();
...
...
@@ -567,8 +574,13 @@ export default {
};
const
getTime
=
date
=>
!
date
?
undefined
:
new
Date
(
date
).
toLocaleTimeString
().
substring
(
0
,
5
);
const
formatString
=
(
str
,
...
args
)
=>
{
let
shouldStylize
=
true
;
if
(
typeof
args
[
args
.
length
-
1
]
===
'
boolean
'
&&
args
[
args
.
length
-
1
]
===
false
)
shouldStylize
=
false
;
return
str
.
replace
(
/
\{(\d
+
)\}
/g
,
(
match
,
number
)
=>
{
return
stylize
(
typeof
args
[
number
]
!=
'
undefined
'
?
args
[
number
]
:
match
);
return
shouldStylize
?
stylize
(
typeof
args
[
number
]
!=
'
undefined
'
?
args
[
number
]
:
match
)
:
(
typeof
args
[
number
]
!=
'
undefined
'
?
args
[
number
]
:
match
);
});
}
...
...
@@ -619,7 +631,8 @@ export default {
desc
+=
formatString
(
data
.
description
==
""
?
Lang
.
CurrentLang
.
CONFIRM_TRIP_NO_INFOS
+
"
.
"
:
Lang
.
CurrentLang
.
CONFIRM_TRIP_INFOS
,
"
\n
"
+
data
.
description
.
split
(
"
\n
"
).
map
(
l
=>
stylize
(
l
)).
join
(
"
\n
"
)
"
\n
"
+
data
.
description
.
split
(
"
\n
"
).
map
(
l
=>
stylize
(
l
)).
join
(
"
\n
"
),
false
);
const
lines
=
desc
.
split
(
"
\n
"
);
...
...
@@ -632,7 +645,7 @@ export default {
p
.
classList
.
add
(
"
mt-4
"
);
text
=
line
.
substring
(
1
);
}
p
.
inner
Text
=
text
;
p
.
inner
HTML
=
text
;
tripDesc
.
appendChild
(
p
);
});
...
...
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