diff options
Diffstat (limited to 'validators.go')
-rw-r--r-- | validators.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/validators.go b/validators.go index 7386c23..dd45014 100644 --- a/validators.go +++ b/validators.go @@ -19,6 +19,7 @@ package mg import ( "strings" + "strconv" "slices" ) @@ -235,8 +236,12 @@ func validateAnimeRankingParams(params *RankingParams) error { func validateSeasonalParams(params *SeasonalParams) error { // check if year is int + _, err := strconv.Atoi(params.Year) + if err != nil { + return ErrInvalidYear + } - err := validateAnimeSeason(params.Season) + err = validateAnimeSeason(params.Season) if err != nil { return err } @@ -302,7 +307,6 @@ func validateMangaSearchParams(params *SearchParams) error { return err } - func validateMangaRankingParams(params *RankingParams) error { err := validateMangaRankingType(params.RankingType) if err != nil { @@ -318,7 +322,6 @@ func validateMangaRankingParams(params *RankingParams) error { return err } - func validateMangaListParams(params *ListParams) error { // if username is empty, set it to @me if strings.TrimSpace(params.Username) == "" { |