File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
kadai2/tanaka0325/imgconv Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 11package imgconv
22
33import (
4- "errors"
54 "fmt"
65 "strings"
76)
@@ -19,19 +18,20 @@ func (opt Options) validate(allowList []string) error {
1918 targetExts := []string {to , from }
2019
2120 for _ , e := range targetExts {
22- if err := include (allowList , e ); err != nil {
23- return fmt .Errorf ("%w . ext is only allowd in %s" , err , allowList )
21+ if ! isInclude (allowList , e ) {
22+ return fmt .Errorf ("%s is not allowed . ext is only allowed in %s" , e , allowList )
2423 }
2524 }
2625
2726 return nil
2827}
2928
30- func include (list []string , w string ) error {
29+ func isInclude (list []string , w string ) bool {
3130 for _ , e := range list {
3231 if e == w {
33- return nil
32+ return true
3433 }
3534 }
36- return errors .New (w + " is not allowed" )
35+
36+ return false
3737}
You can’t perform that action at this time.
0 commit comments