This commit is contained in:
2020-03-16 22:32:28 +00:00
parent a5e805c858
commit fd63ad2320
2 changed files with 15 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ namespace AyaNova.PickList
//determine this in advance as it will be used in a loop later //determine this in advance as it will be used in a loop later
bool HasAutoCompleteQuery = !string.IsNullOrWhiteSpace(autoCompleteQuery); bool HasAutoCompleteQuery = !string.IsNullOrWhiteSpace(autoCompleteQuery);
bool HasTagSpecificQuery = !string.IsNullOrWhiteSpace(tagSpecificQuery);
//lists to collect the clauses so to avoid comma fuckery //lists to collect the clauses so to avoid comma fuckery

View File

@@ -73,16 +73,26 @@ namespace AyaNova.Biz
{ {
// split the query on space // split the query on space
var querySegments = AutoCompleteQuery.Split(' '); var querySegments = AutoCompleteQuery.Split(' ');
if (querySegments.Length > 2)
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:PickListQueryInvalid");
return null;
}
// users may type several spaces in a regular query, so ignore that and only use the first two segments // users may type several spaces in a regular query, so ignore that and only use the first two segments
if (querySegments[0].Contains("..")) if (querySegments[0].Contains(".."))
{ {
TagSpecificQuery = querySegments[0].Replace("..", ""); TagSpecificQuery = querySegments[0].Replace("..", "");
// the second string is considered the
AutoCompleteQuery = querySegments[1]; AutoCompleteQuery = querySegments[1];
} }
else if (querySegments[1].Contains(".."))
{
TagSpecificQuery = querySegments[1].Replace("..", "");
AutoCompleteQuery = querySegments[0];
}
else else
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:PickListQueryInvalid");
return null;
} }
} }