From c9bc68839100a38bb1aa48baf94dc576fb4810aa Mon Sep 17 00:00:00 2001 From: xmdhs Date: Fri, 8 Sep 2023 23:10:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/yggdrasil/texture.go | 4 ++-- service/yggdrasil/yggdrasil.go | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) 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 {