Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Elasticsearch Services
Search Doc Service
Commits
570c0fc9
Commit
570c0fc9
authored
Feb 21, 2022
by
Jonas Waeber
Browse files
Add check to prevent substring going beyond string.
parent
4919cac2
Pipeline
#43315
passed with stages
in 4 minutes and 18 seconds
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
src/main/kotlin/ch/memobase/helpers/DateFacetBuildHelpers.kt
View file @
570c0fc9
...
...
@@ -55,6 +55,10 @@ object DateFacetBuildHelpers {
* @return The facet values used by outermedia.
*/
fun
buildFromNormalizedDateRange
(
date
:
String
):
List
<
String
>
{
if
(
date
.
length
<=
3
)
{
log
.
error
(
"Normalized date range has less than 4 characters: $date."
)
return
emptyList
()
}
val
from
=
date
.
substring
(
0
,
4
)
val
until
=
if
(
date
.
contains
(
"/"
))
{
val
secondPart
=
date
.
split
(
"/"
)[
1
]
...
...
Write
Preview
Supports
Markdown
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