resolve comments

pull/3234/head
Aaron Liu 8 months ago
parent d06a29e8a3
commit daba550ea7

@ -3,9 +3,10 @@ package inventory
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/cloudreve/Cloudreve/v4/inventory/types"
"time" "time"
"github.com/cloudreve/Cloudreve/v4/inventory/types"
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql"
"github.com/cloudreve/Cloudreve/v4/ent" "github.com/cloudreve/Cloudreve/v4/ent"
"github.com/cloudreve/Cloudreve/v4/ent/file" "github.com/cloudreve/Cloudreve/v4/ent/file"
@ -23,14 +24,6 @@ type (
LoadShareUser struct{} 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 ( var (
ErrShareLinkExpired = fmt.Errorf("share link expired") ErrShareLinkExpired = fmt.Errorf("share link expired")
ErrOwnerInactive = fmt.Errorf("owner is inactive") ErrOwnerInactive = fmt.Errorf("owner is inactive")

@ -166,7 +166,7 @@ func renderShareOGPage(c *gin.Context, dep dependency.Dep, id, password string)
data.Title = shareInfo.Name data.Title = shareInfo.Name
if shareInfo.SourceType != nil && *shareInfo.SourceType == types.FileTypeFolder { if shareInfo.SourceType != nil && *shareInfo.SourceType == types.FileTypeFolder {
data.Description = "Folder" data.Description = "Folder"
} else { } else if shareInfo.Unlocked {
data.Description = formatFileSize(shareInfo.Size) data.Description = formatFileSize(shareInfo.Size)
thumbnail, err := loadShareThumbnail(c, id, password, shareInfo) thumbnail, err := loadShareThumbnail(c, id, password, shareInfo)
if err == nil { if err == nil {

Loading…
Cancel
Save