mirror of https://github.com/Xhofe/alist
fix: `whereInParent` when parent = "/" (#2706)
parent
7947ff1ae4
commit
cdc45630ae
|
@ -12,10 +12,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func whereInParent(parent string) *gorm.DB {
|
func whereInParent(parent string) *gorm.DB {
|
||||||
|
if parent == "/" {
|
||||||
|
return db.Where("1 = 1")
|
||||||
|
}
|
||||||
return db.Where(fmt.Sprintf("%s LIKE ?", columnName("parent")),
|
return db.Where(fmt.Sprintf("%s LIKE ?", columnName("parent")),
|
||||||
fmt.Sprintf("%s/%%", parent)).
|
fmt.Sprintf("%s/%%", parent)).
|
||||||
Or(fmt.Sprintf("%s = ?", columnName("parent")),
|
Or(fmt.Sprintf("%s = ?", columnName("parent")), parent)
|
||||||
fmt.Sprintf("%s%%", parent))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateSearchNode(node *model.SearchNode) error {
|
func CreateSearchNode(node *model.SearchNode) error {
|
||||||
|
|
Loading…
Reference in New Issue