mirror of
https://github.com/miniflux/v2.git
synced 2025-10-10 19:32:06 +00:00
fix(timezone): make sure legacy time zones are no longer used
Debian Trixie has removed several time zones. This change makes sure only the current IANA time zones are in use.
This commit is contained in:
parent
4eff9129ab
commit
b1742168e1
6 changed files with 652 additions and 54 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"miniflux.app/v2/internal/locale"
|
||||
"miniflux.app/v2/internal/model"
|
||||
"miniflux.app/v2/internal/storage"
|
||||
"miniflux.app/v2/internal/timezone"
|
||||
)
|
||||
|
||||
// ValidateUserCreationWithPassword validates user creation with a password.
|
||||
|
@ -63,7 +64,7 @@ func ValidateUserModification(store *storage.Storage, userID int64, changes *mod
|
|||
}
|
||||
|
||||
if changes.Timezone != nil {
|
||||
if err := validateTimezone(store, *changes.Timezone); err != nil {
|
||||
if err := validateTimezone(*changes.Timezone); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -200,13 +201,8 @@ func validateLanguage(language string) *locale.LocalizedError {
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateTimezone(store *storage.Storage, timezone string) *locale.LocalizedError {
|
||||
timezones, err := store.Timezones()
|
||||
if err != nil {
|
||||
return locale.NewLocalizedError(err.Error())
|
||||
}
|
||||
|
||||
if _, found := timezones[timezone]; !found {
|
||||
func validateTimezone(timezoneValue string) *locale.LocalizedError {
|
||||
if _, found := timezone.AvailableTimezones()[timezoneValue]; !found {
|
||||
return locale.NewLocalizedError("error.invalid_timezone")
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue