File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
main/java/com/coditory/quark/i18n/loader
test/groovy/com/coditory/quark/i18n/loader Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ private I18nPath extractPath(Matcher matcher) {
165165 String prefix = null ;
166166 if (activeGroups .containsKey (PREFIXES_GROUP_MARKER )) {
167167 String prefixesMatch = matcher .group ("prefixes" );
168- if (prefixesMatch != null && !prefixesMatch .equals ("/" )) {
168+ if (prefixesMatch != null && !prefixesMatch .isEmpty () && ! prefixesMatch . equals ("/" )) {
169169 prefix = prefixesMatch .substring (0 , prefixesMatch .length () - 1 );
170170 }
171171 }
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class I18nPathPatternSpec extends Specification {
4242 " /abc/*.json" | " /abc/x.json.json"
4343 " /abc/*.*.json" | " /abc/x.xml.json"
4444 // capturing groups
45+ " /abc/{prefixes}/i18n.json" | " /abc/i18n.json"
4546 " /abc/{prefixes}/*.json" | " /abc/def/xxx.json"
4647 " {prefixes}/*.json" | " /abc/def/xxx.json"
4748 " /abc/**/i18n_{locale}.json" | " /abc/def/i18n_pl-PL.json"
@@ -135,11 +136,12 @@ class I18nPathPatternSpec extends Specification {
135136 when :
136137 I18nPathGroups matched = matchGroups(pattern, input)
137138 then :
138- matched. path() == I18nPath . of(path)
139+ matched. path() == (path == null ? null : I18nPath . of(path) )
139140 where :
140141 pattern | input || path
141142 " **/i18n-{prefix}.yml" | " /abc/i18n-homepage.yml" || " homepage"
142143 " /i18n/{prefix}.yml" | " /i18n/glossary.yml" || " glossary"
144+ " com/i18n/{prefixes}/i18n.yml" | " com/i18n/i18n.yml" || null
143145 " com/i18n/{prefixes}/i18n.yml" | " com/i18n/abc/def/i18n.yml" || " abc.def"
144146 " com/i18n/{prefixes}/i18n-{prefix}.yml" | " com/i18n/abc/def/i18n-base.yml" || " abc.def.base"
145147 " com/i18n/{prefixes}/xxx/i18n.yml" | " com/i18n/abc/def/xxx/i18n.yml" || " abc.def"
You can’t perform that action at this time.
0 commit comments