mirror of
https://github.com/chainreactors/spray.git
synced 2025-08-13 03:16:37 +00:00
fix abs path parse
This commit is contained in:
parent
13530eee5d
commit
b2d85a7698
@ -32,7 +32,7 @@ func Spray() {
|
||||
var option internal.Option
|
||||
|
||||
if files.IsExist(DefaultConfig) {
|
||||
logs.Log.Warnf("config.yaml exist, loading")
|
||||
logs.Log.Debug("config.yaml exist, loading")
|
||||
err := internal.LoadConfig(DefaultConfig, &option)
|
||||
if err != nil {
|
||||
logs.Log.Error(err.Error())
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module github.com/chainreactors/spray
|
||||
|
||||
go 1.21.3
|
||||
go 1.21
|
||||
|
||||
require github.com/chainreactors/go-metrics v0.0.0-20220926021830-24787b7a10f8
|
||||
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -417,7 +418,6 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
}
|
||||
|
||||
ports := utils.ParsePort(opt.PortRange)
|
||||
|
||||
// prepare task
|
||||
tasks := make(chan *Task, opt.PoolSize)
|
||||
var taskfrom string
|
||||
@ -486,14 +486,13 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
} else if opt.URLFile != "" {
|
||||
file, err = os.Open(opt.URLFile)
|
||||
if err != nil {
|
||||
logs.Log.Error(err.Error())
|
||||
return nil, err
|
||||
}
|
||||
taskfrom = opt.URLFile
|
||||
taskfrom = filepath.Base(opt.URLFile)
|
||||
} else if files.HasStdin() {
|
||||
file = os.Stdin
|
||||
taskfrom = "stdin"
|
||||
}
|
||||
|
||||
if file != nil {
|
||||
content, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user