fix version 1

This commit is contained in:
2026-09-22 21:15:34 +08:00
parent 9f86366638
commit d63d7e8b3a
277 changed files with 9959 additions and 1514 deletions

View File

@@ -36,8 +36,15 @@ func GetShare(ctx context.Context, in *pb.IdentRequest) (reply *pb.CloudShareIte
}
if err := query.First(&share).Error; err != nil {
printer.Error("Share not found: %v", err)
return nil, errcode.ErrInvalidArgument
// 非创建者:凭分享 identity 可读取公开分享,使收件人能够取到分享指向的资源
if in.Id > 0 || in.Identity == "" {
printer.Error("Share not found: %v", err)
return nil, errcode.ErrInvalidArgument
}
if err := impl.DBService.Where("identity = ? AND is_public = ?", in.Identity, true).First(&share).Error; err != nil {
printer.Error("Share not found: %v", err)
return nil, errcode.ErrInvalidArgument
}
}
// 检查是否过期
@@ -45,13 +52,19 @@ func GetShare(ctx context.Context, in *pb.IdentRequest) (reply *pb.CloudShareIte
return nil, errcode.ErrInvalidArgument
}
// 非创建者读取分享时不回传分享密码
password := share.Password
if share.PassportID != auth.ID {
password = ""
}
reply = &pb.CloudShareItem{
Id: uint64(share.ID),
Identity: share.Identity,
ShareType: share.ShareType,
ResourceId: uint64(share.ResourceID),
ShareToken: share.ShareToken,
Password: share.Password,
Password: password,
ExpiresAt: share.ExpiresAt.Format(time.RFC3339),
ViewCount: int32(share.ViewCount),
DownloadCount: int32(share.DownloadCount),