Fix search category filter when subcategory's length exceeds 1 character (#457)
* Fixed search category filter when subcategory's length exceeds 1 character * Changed the subcategory's length check to not let the possibility to overflow
Cette révision appartient à :
Parent
93b83fbfc9
révision
a9019bb490
1 fichiers modifiés avec 4 ajouts et 4 suppressions
|
@ -87,8 +87,8 @@ func searchByQuery(r *http.Request, pagenum int, countAll bool) (
|
||||||
}
|
}
|
||||||
search.Category.Main = uint8(tmp)
|
search.Category.Main = uint8(tmp)
|
||||||
|
|
||||||
if len(s) == 3 {
|
if len(s) > 2 && len(s) < 5 {
|
||||||
tmp, err = strconv.ParseUint(string(s[2]), 10, 8)
|
tmp, err = strconv.ParseUint(s[2:], 10, 8)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ func searchByQuery(r *http.Request, pagenum int, countAll bool) (
|
||||||
|
|
||||||
if search.Category.Main != 0 {
|
if search.Category.Main != 0 {
|
||||||
conditions = append(conditions, "category = ?")
|
conditions = append(conditions, "category = ?")
|
||||||
parameters.Params = append(parameters.Params, string(catString[0]))
|
parameters.Params = append(parameters.Params, search.Category.Main)
|
||||||
}
|
}
|
||||||
if search.UserID != 0 {
|
if search.UserID != 0 {
|
||||||
conditions = append(conditions, "uploader = ?")
|
conditions = append(conditions, "uploader = ?")
|
||||||
|
@ -159,7 +159,7 @@ func searchByQuery(r *http.Request, pagenum int, countAll bool) (
|
||||||
}
|
}
|
||||||
if search.Category.Sub != 0 {
|
if search.Category.Sub != 0 {
|
||||||
conditions = append(conditions, "sub_category = ?")
|
conditions = append(conditions, "sub_category = ?")
|
||||||
parameters.Params = append(parameters.Params, string(catString[2]))
|
parameters.Params = append(parameters.Params, search.Category.Sub)
|
||||||
}
|
}
|
||||||
if search.Status != 0 {
|
if search.Status != 0 {
|
||||||
if search.Status == common.FilterRemakes {
|
if search.Status == common.FilterRemakes {
|
||||||
|
|
Référencer dans un nouveau ticket