Inventorian

Inventorian

660k Downloads

Bag search not managing string escape characters

Zaazu opened this issue ยท 0 comments

commented

Hey, various escape characters such as %, [, ( and others typed into the bag search box cause various lua errors to show up such as:

1x Inventorian/libs/LibItemSearch-1.0.lua:58: malformed pattern (ends with '%')
[string "=[C]"]: in function `find'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:58: in function <Inventorian/libs/LibItemSearch-1.0.lua:55>
[string "=(tail call)"]: ?
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:192: in function `UseTypedSearch'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:179: in function <Inventorian/libs/LibItemSearch-1.0.lua:145>
[string "=(tail call)"]: ?
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:98: in function `FindIntersectSearch'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:87: in function <Inventorian/libs/LibItemSearch-1.0.lua:84>
[string "=(tail call)"]: ?
[string "@Inventorian/Item.lua"]:239: in function `UpdateSearch'
[string "@Inventorian/ItemContainer.lua"]:116: in function `UpdateSearch'
[string "@Inventorian/ItemContainer.lua"]:111: in function `Search'
[string "@Inventorian/Frame.lua"]:328: in function `OnSearchTextChanged'
[string "*Frame.xml:128_OnTextChanged"]:2: in function <[string "*Frame.xml:128_OnTextChanged"]:1>

Locals:
(*temporary) = "earthen charm"
(*temporary) = "%"
74x Inventorian/libs/LibItemSearch-1.0.lua:58: malformed pattern (missing ']')
[string "=[C]"]: in function `find'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:58: in function <Inventorian/libs/LibItemSearch-1.0.lua:55>
[string "=(tail call)"]: ?
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:192: in function `UseTypedSearch'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:179: in function <Inventorian/libs/LibItemSearch-1.0.lua:145>
[string "=(tail call)"]: ?
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:98: in function `FindIntersectSearch'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:87: in function <Inventorian/libs/LibItemSearch-1.0.lua:84>
[string "=(tail call)"]: ?
[string "@Inventorian/Item.lua"]:239: in function `UpdateSearch'
[string "@Inventorian/ItemContainer.lua"]:116: in function `UpdateSearch'
[string "@Inventorian/ItemContainer.lua"]:111: in function `Search'
[string "@Inventorian/Frame.lua"]:328: in function `OnSearchTextChanged'
[string "*Frame.xml:128_OnTextChanged"]:2: in function <[string "*Frame.xml:128_OnTextChanged"]:1>

Locals:
(*temporary) = "sandworn chest key"
(*temporary) = "["
22x Inventorian/libs/LibItemSearch-1.0.lua:58: unfinished capture
[string "=[C]"]: in function `find'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:58: in function <Inventorian/libs/LibItemSearch-1.0.lua:55>
[string "=(tail call)"]: ?
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:193: in function `UseTypedSearch'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:180: in function <Inventorian/libs/LibItemSearch-1.0.lua:146>
[string "=(tail call)"]: ?
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:99: in function `FindIntersectSearch'
[string "@Inventorian/libs/LibItemSearch-1.0.lua"]:88: in function <Inventorian/libs/LibItemSearch-1.0.lua:85>
[string "=(tail call)"]: ?
[string "@Inventorian/Item.lua"]:239: in function `UpdateSearch'
[string "@Inventorian/ItemContainer.lua"]:116: in function `UpdateSearch'
[string "@Inventorian/ItemContainer.lua"]:111: in function `Search'
[string "@Inventorian/Frame.lua"]:328: in function `OnSearchTextChanged'
[string "*Frame.xml:128_OnTextChanged"]:2: in function <[string "*Frame.xml:128_OnTextChanged"]:1>

Locals:
(*temporary) = "earthen charm"
(*temporary) = "("
(*temporary) = 1
(*temporary) = 0

You probably just need to add a check into the LibItemSearch-1.0.lua Find() function and either filter out these characters, or mark them with % to denote a literal character.

Here is a potential solution:
https://stackoverflow.com/questions/9790688/escaping-strings-for-gsub

Loving the addon, cheers.