- "set_url": couldn't set a new path for filter local file
Close #1984 * commit '99625da1e44b4e6686f3c4b29526949ef471a100': - "set_url": couldn't set a new path for filter local file
This commit is contained in:
commit
335d62b08e
|
@ -17,8 +17,8 @@ import (
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsValidURL - return TRUE if URL or file path is valid
|
// isValidURL - return TRUE if URL or file path is valid
|
||||||
func IsValidURL(rawurl string) bool {
|
func isValidURL(rawurl string) bool {
|
||||||
if filepath.IsAbs(rawurl) {
|
if filepath.IsAbs(rawurl) {
|
||||||
// this is a file path
|
// this is a file path
|
||||||
return util.FileExists(rawurl)
|
return util.FileExists(rawurl)
|
||||||
|
@ -48,7 +48,7 @@ func (f *Filtering) handleFilteringAddURL(w http.ResponseWriter, r *http.Request
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !IsValidURL(fj.URL) {
|
if !isValidURL(fj.URL) {
|
||||||
http.Error(w, "Invalid URL or file path", http.StatusBadRequest)
|
http.Error(w, "Invalid URL or file path", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ func (f *Filtering) handleFilteringSetURL(w http.ResponseWriter, r *http.Request
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !IsValidURL(fj.URL) {
|
if !isValidURL(fj.Data.URL) {
|
||||||
http.Error(w, "invalid URL or file path", http.StatusBadRequest)
|
http.Error(w, "invalid URL or file path", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue