修复错误
This commit is contained in:
parent
3d2f3452ff
commit
f966b1bfdc
@ -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)
|
ut, err := client.UserToken.Query().Where(usertoken.HasUserWith(user.ID(claims.UID))).First(ctx)
|
||||||
if err != nil {
|
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)
|
return nil, fmt.Errorf("Auth: %w", err)
|
||||||
}
|
}
|
||||||
if strconv.FormatUint(ut.TokenID, 10) != claims.Tid {
|
if strconv.FormatUint(ut.TokenID, 10) != claims.Tid {
|
||||||
|
@ -99,7 +99,7 @@ func (y *Yggdrasil) PutTexture(ctx context.Context, token string, texturebyte []
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t == nil {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user