mirror of
https://github.com/miniflux/v2.git
synced 2025-08-21 18:11:09 +00:00
Validate Keep list and Block list rules syntax
This commit is contained in:
parent
05fd83bd6f
commit
e8d0360e64
19 changed files with 173 additions and 23 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
"miniflux.app/errors"
|
||||
"miniflux.app/validator"
|
||||
)
|
||||
|
||||
// SubscriptionForm represents the subscription form.
|
||||
|
@ -32,6 +33,18 @@ func (s *SubscriptionForm) Validate() error {
|
|||
return errors.NewLocalizedError("error.feed_mandatory_fields")
|
||||
}
|
||||
|
||||
if !validator.IsValidURL(s.URL) {
|
||||
return errors.NewLocalizedError("error.invalid_feed_url")
|
||||
}
|
||||
|
||||
if !validator.IsValidRegex(s.BlocklistRules) {
|
||||
return errors.NewLocalizedError("error.feed_invalid_blocklist_rule")
|
||||
}
|
||||
|
||||
if !validator.IsValidRegex(s.KeeplistRules) {
|
||||
return errors.NewLocalizedError("error.feed_invalid_keeplist_rule")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue