修复无法删除的 bug

This commit is contained in:
xmdhs 2023-09-08 23:10:33 +08:00
parent bdd93bd7d2
commit c9bc688391
No known key found for this signature in database
GPG Key ID: E809D6D43DEFCC95
2 changed files with 6 additions and 7 deletions

View File

@ -49,9 +49,9 @@ func (y *Yggdrasil) delTexture(ctx context.Context, userProfileID int, textureTy
if err != nil { if err != nil {
return err 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) err = os.Remove(path)
if err != nil { if err != nil && !errors.Is(err, os.ErrNotExist) {
return err return err
} }
// Texture 表中删除记录 // Texture 表中删除记录

View File

@ -18,7 +18,6 @@ type Yggdrasil struct {
cache cache.Cache cache cache.Cache
config config.Config config config.Config
prikey *rsa.PrivateKey prikey *rsa.PrivateKey
TexturePath string
} }
func NewYggdrasil(client *ent.Client, cache cache.Cache, c config.Config, prikey *rsa.PrivateKey) *Yggdrasil { func NewYggdrasil(client *ent.Client, cache cache.Cache, c config.Config, prikey *rsa.PrivateKey) *Yggdrasil {