diff --git a/inventory/share.go b/inventory/share.go index d6928bd4..642ce21c 100644 --- a/inventory/share.go +++ b/inventory/share.go @@ -3,9 +3,10 @@ package inventory import ( "context" "fmt" - "github.com/cloudreve/Cloudreve/v4/inventory/types" "time" + "github.com/cloudreve/Cloudreve/v4/inventory/types" + "entgo.io/ent/dialect/sql" "github.com/cloudreve/Cloudreve/v4/ent" "github.com/cloudreve/Cloudreve/v4/ent/file" @@ -23,14 +24,6 @@ type ( LoadShareUser struct{} ) -// WithShareEagerLoad returns a context with share eager loading options enabled. -// This loads the share's associated user and file when querying. -func WithShareEagerLoad(ctx context.Context) context.Context { - ctx = context.WithValue(ctx, LoadShareUser{}, true) - ctx = context.WithValue(ctx, LoadShareFile{}, true) - return ctx -} - var ( ErrShareLinkExpired = fmt.Errorf("share link expired") ErrOwnerInactive = fmt.Errorf("owner is inactive") diff --git a/middleware/share_preview.go b/middleware/share_preview.go index 2f51964d..1537dfff 100644 --- a/middleware/share_preview.go +++ b/middleware/share_preview.go @@ -166,7 +166,7 @@ func renderShareOGPage(c *gin.Context, dep dependency.Dep, id, password string) data.Title = shareInfo.Name if shareInfo.SourceType != nil && *shareInfo.SourceType == types.FileTypeFolder { data.Description = "Folder" - } else { + } else if shareInfo.Unlocked { data.Description = formatFileSize(shareInfo.Size) thumbnail, err := loadShareThumbnail(c, id, password, shareInfo) if err == nil {