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 1
1
package imgconv
2
2
3
3
import (
4
- "errors"
5
4
"fmt"
6
5
"strings"
7
6
)
@@ -19,19 +18,20 @@ func (opt Options) validate(allowList []string) error {
19
18
targetExts := []string {to , from }
20
19
21
20
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 )
24
23
}
25
24
}
26
25
27
26
return nil
28
27
}
29
28
30
- func include (list []string , w string ) error {
29
+ func isInclude (list []string , w string ) bool {
31
30
for _ , e := range list {
32
31
if e == w {
33
- return nil
32
+ return true
34
33
}
35
34
}
36
- return errors .New (w + " is not allowed" )
35
+
36
+ return false
37
37
}
You can’t perform that action at this time.
0 commit comments