fix(direct link): cannot access direct link for files without blobs (close #3239)

master 4.13.0
Aaron Liu 2 days ago
parent 6322a9e951
commit ec9fdd33bc

@ -17,7 +17,6 @@ import (
"github.com/cloudreve/Cloudreve/v4/pkg/hashid"
"github.com/cloudreve/Cloudreve/v4/pkg/serializer"
"github.com/gofrs/uuid"
"github.com/samber/lo"
)
type (
@ -153,13 +152,7 @@ func (m *manager) GetUrlForRedirectedDirectLink(ctx context.Context, dl *ent.Dir
}
// Find primary entity
target, found := lo.Find(file.Entities(), func(entity fs.Entity) bool {
return entity.ID() == file.PrimaryEntityID()
})
if !found {
return "", nil, fs.ErrDirectLinkInvalid.WithError(fmt.Errorf("primary entity not found"))
}
primaryEntity := target
primaryEntity := file.PrimaryEntity()
// Generate url
var (

Loading…
Cancel
Save