Skip to content

Commit

Permalink
[ODS-4903] Load tool - year specific mode issue (#305)
Browse files Browse the repository at this point in the history
* fixed the regex to support numbers in the server name

* fixed year for xml lookup

* fixed year for smoke tests

* remove trailing slash from regex

* fix regex replacement value

* update regex link

Co-authored-by: travis.meador <[email protected]>
  • Loading branch information
jamessmckay and tmeador-dl authored Mar 24, 2021
1 parent 0e37980 commit 56330e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ string ResolvedUrl(string url)
{
return apiMode == ApiMode.YearSpecific
? Regex.Replace(
url, @"(?<year>\d{4})\b", configuration.GetValue<string>("OdsApi:SchoolYear"), RegexOptions.None)

// https://regex101.com/r/KywmUK/1
url, @"\/(?<year>\b\d{4}\b)", $"/{configuration.GetValue<string>("OdsApi:SchoolYear")}", RegexOptions.None)
: url;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ string ResolvedUrl(string url)
{
return apiMode == ApiMode.YearSpecific
? Regex.Replace(
url, @"(?<year>\d{4})\b", configuration.GetValue<string>("OdsApi:SchoolYear"), RegexOptions.None)

// https://regex101.com/r/KywmUK/1
url, @"\/(?<year>\b\d{4}\b)", $"/{configuration.GetValue<string>("OdsApi:SchoolYear")}", RegexOptions.None)
: url;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ string ResolvedUrl(string url)
{
return apiMode == ApiMode.YearSpecific
? Regex.Replace(
url, @"(?<year>\d{4})\b", configuration.GetValue<string>("OdsApi:SchoolYear"), RegexOptions.None)

// https://regex101.com/r/KywmUK/1
url, @"\/(?<year>\b\d{4}\b)", $"/{configuration.GetValue<string>("OdsApi:SchoolYear")}", RegexOptions.None)
: url;
}
}
Expand Down

0 comments on commit 56330e0

Please sign in to comment.