Move users avatar directory (#760)

This commit is contained in:
Thomas
2026-07-03 17:05:50 +08:00
committed by GitHub
parent 06c49f3880
commit 1720e886eb
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ type User struct {
CreatedAt int64
Email string
MD5Hash string // for gravatar, if no Email is specified, the value is random
AvatarURL string // an absolute URL (from an OAuth provider) or a bare filename for a manually uploaded avatar stored under {home}/avatars
AvatarURL string // an absolute URL (from an OAuth provider) or a bare filename for a manually uploaded avatar stored under {home}/avatars/users
GithubID string
GitlabID string
GiteaID string
@@ -101,7 +101,7 @@ func (user *User) BeforeDelete(tx *gorm.DB) error {
// Delete uploaded avatar, if any
if user.HasUploadedAvatar() {
_ = os.Remove(filepath.Join(config.GetHomeDir(), "avatars", filepath.Base(user.AvatarURL)))
_ = os.Remove(filepath.Join(config.GetHomeDir(), "avatars", "users", filepath.Base(user.AvatarURL)))
}
return nil
+1 -1
View File
@@ -23,7 +23,7 @@ var allowedAvatarTypes = map[string]string{
}
func AvatarsDir() string {
return filepath.Join(config.GetHomeDir(), "avatars")
return filepath.Join(config.GetHomeDir(), "avatars", "users")
}
func AvatarProcess(ctx *context.Context) error {