diff --git a/service/yggdrasil/texture.go b/service/yggdrasil/texture.go index 734e8cb..9246e2e 100644 --- a/service/yggdrasil/texture.go +++ b/service/yggdrasil/texture.go @@ -49,9 +49,9 @@ func (y *Yggdrasil) delTexture(ctx context.Context, userProfileID int, textureTy if err != nil { return err } - path := filepath.Join(y.TexturePath, t.TextureHash[:2], t.TextureHash[2:4], t.TextureHash) + path := filepath.Join(y.config.TexturePath, t.TextureHash[:2], t.TextureHash[2:4], t.TextureHash) err = os.Remove(path) - if err != nil { + if err != nil && !errors.Is(err, os.ErrNotExist) { return err } // Texture 表中删除记录 diff --git a/service/yggdrasil/yggdrasil.go b/service/yggdrasil/yggdrasil.go index 00d6635..9cff0ca 100644 --- a/service/yggdrasil/yggdrasil.go +++ b/service/yggdrasil/yggdrasil.go @@ -14,11 +14,10 @@ import ( ) type Yggdrasil struct { - client *ent.Client - cache cache.Cache - config config.Config - prikey *rsa.PrivateKey - TexturePath string + client *ent.Client + cache cache.Cache + config config.Config + prikey *rsa.PrivateKey } func NewYggdrasil(client *ent.Client, cache cache.Cache, c config.Config, prikey *rsa.PrivateKey) *Yggdrasil {