修复错误

This commit is contained in:
xmdhs 2023-09-08 22:22:43 +08:00
parent 3d2f3452ff
commit f966b1bfdc
No known key found for this signature in database
GPG Key ID: E809D6D43DEFCC95
2 changed files with 5 additions and 1 deletions

View File

@ -53,6 +53,10 @@ func Auth(ctx context.Context, t yggdrasil.ValidateToken, client *ent.Client, pu
ut, err := client.UserToken.Query().Where(usertoken.HasUserWith(user.ID(claims.UID))).First(ctx)
if err != nil {
var ne *ent.NotFoundError
if !errors.As(err, &ne) {
return nil, fmt.Errorf("Auth: %w", errors.Join(err, ErrTokenInvalid))
}
return nil, fmt.Errorf("Auth: %w", err)
}
if strconv.FormatUint(ut.TokenID, 10) != claims.Tid {

View File

@ -99,7 +99,7 @@ func (y *Yggdrasil) PutTexture(ctx context.Context, token string, texturebyte []
}
}
if t == nil {
err = tx.Texture.Create().SetCreatedUser(u).SetTextureHash(hashstr).Exec(ctx)
t, err = tx.Texture.Create().SetCreatedUser(u).SetTextureHash(hashstr).Save(ctx)
if err != nil {
return err
}