fix(server): restore and persist file index

This commit is contained in:
hexxa 2022-07-30 20:44:22 +08:00 committed by Hexxa
parent 591b50c51f
commit f0293fbc4c
4 changed files with 30 additions and 16 deletions

View file

@ -282,19 +282,13 @@ func (h *FileHandlers) Delete(c *gin.Context) {
var txErr error
locker := h.NewAutoLocker(c, lockName(filePath))
locker.Exec(func() {
info, err := h.deps.FS().Stat(filePath)
if err != nil {
txErr = err
return
}
err = h.deps.FS().Remove(filePath)
if err != nil {
txErr = err
return
}
err = h.deps.BoltStore().DelInfos(userIDInt, filePath, info.IsDir())
err = h.deps.BoltStore().DelInfos(userIDInt, filePath)
if err != nil {
txErr = err
return
@ -1173,7 +1167,6 @@ func (h *FileHandlers) SearchItems(c *gin.Context) {
}
for _, searchResult := range searchResults {
fmt.Println(keyword, searchResult)
if _, ok := resultsMap[searchResult]; !ok {
resultsMap[searchResult] = 0
}