hotfix
This commit is contained in:
@@ -222,12 +222,14 @@ func (c *Cache) load() (map[string]*CachedTorrent, error) {
|
|||||||
isComplete := true
|
isComplete := true
|
||||||
if len(ct.Files) != 0 {
|
if len(ct.Files) != 0 {
|
||||||
// Check if all files are valid, if not, delete the file.json and remove from cache.
|
// Check if all files are valid, if not, delete the file.json and remove from cache.
|
||||||
|
fs := make(map[string]types.File, len(ct.Files))
|
||||||
for _, f := range ct.Files {
|
for _, f := range ct.Files {
|
||||||
f.TorrentId = ct.Id
|
|
||||||
if f.Link == "" {
|
if f.Link == "" {
|
||||||
isComplete = false
|
isComplete = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
f.TorrentId = ct.Id
|
||||||
|
fs[f.Name] = f
|
||||||
}
|
}
|
||||||
|
|
||||||
if isComplete {
|
if isComplete {
|
||||||
@@ -237,6 +239,7 @@ func (c *Cache) load() (map[string]*CachedTorrent, error) {
|
|||||||
}
|
}
|
||||||
ct.IsComplete = true
|
ct.IsComplete = true
|
||||||
ct.Name = path.Clean(ct.Name)
|
ct.Name = path.Clean(ct.Name)
|
||||||
|
ct.Files = fs
|
||||||
results.Store(ct.Id, &ct)
|
results.Store(ct.Id, &ct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package webdav
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"cmp"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
@@ -185,7 +186,7 @@ func (h *Handler) OpenFile(ctx context.Context, name string, flag int, perm os.F
|
|||||||
if file, ok := cachedTorrent.Files[filename]; ok {
|
if file, ok := cachedTorrent.Files[filename]; ok {
|
||||||
return &File{
|
return &File{
|
||||||
cache: h.cache,
|
cache: h.cache,
|
||||||
torrentId: file.TorrentId,
|
torrentId: cmp.Or(file.TorrentId, cachedTorrent.Id),
|
||||||
fileId: file.Id,
|
fileId: file.Id,
|
||||||
isDir: false,
|
isDir: false,
|
||||||
name: file.Name,
|
name: file.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user