mirror of
https://github.com/cloudreve/cloudreve.git
synced 2026-03-03 02:27:00 +00:00
fix(direct link): cannot access direct link for files without blobs (close #3239)
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user