fix regex
(cherry picked from commit a259213a3badc9618e969f2c8db0a0143f00faee)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -72,7 +73,9 @@ func (s *Service) handleCsvFileScenario(ctx context.Context, req *backend.QueryD
|
||||
}
|
||||
|
||||
func (s *Service) loadCsvFile(fileName string) (*data.Frame, error) {
|
||||
if filepath.Ext(fileName) != ".csv" || strings.Contains(fileName, "..") {
|
||||
validFileName := regexp.MustCompile(`^\w+\.csv$`)
|
||||
|
||||
if !validFileName.MatchString(fileName) {
|
||||
return nil, fmt.Errorf("invalid csv file name: %q", fileName)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user