diff --git a/os/gcmd/gcmd_parser.go b/os/gcmd/gcmd_parser.go index a0a6fa57d..b56505d30 100644 --- a/os/gcmd/gcmd_parser.go +++ b/os/gcmd/gcmd_parser.go @@ -59,7 +59,7 @@ func ParseWithArgs(args []string, supportedOptions map[string]bool) (*Parser, er for i := 0; i < len(args); { if option := parser.parseOption(args[i]); option != "" { - array, _ := gregex.MatchString(`^(\w+)=(.+)$`, option) + array, _ := gregex.MatchString(`^(.+?)=(.+)$`, option) if len(array) == 3 { if parser.isOptionValid(array[1]) { parser.setOptionValue(array[1], array[2]) diff --git a/os/gres/gres_resource.go b/os/gres/gres_resource.go index e05cd0773..295f4d5c9 100644 --- a/os/gres/gres_resource.go +++ b/os/gres/gres_resource.go @@ -70,6 +70,7 @@ func (r *Resource) Get(path string) *File { if path == "" { return nil } + path = strings.Replace(path, "\\", "/", -1) if path != "/" { for path[len(path)-1] == '/' { path = path[:len(path)-1] @@ -87,6 +88,7 @@ func (r *Resource) Get(path string) *File { // // GetWithIndex is usually used for http static file service. func (r *Resource) GetWithIndex(path string, indexFiles []string) *File { + path = strings.Replace(path, "\\", "/", -1) if path != "/" { for path[len(path)-1] == '/' { path = path[:len(path)-1] @@ -108,6 +110,7 @@ func (r *Resource) GetWithIndex(path string, indexFiles []string) *File { // GetContent directly returns the content of . func (r *Resource) GetContent(path string) []byte { + path = strings.Replace(path, "\\", "/", -1) file := r.Get(path) if file != nil { return file.Content() @@ -161,6 +164,7 @@ func (r *Resource) ScanDirFile(path string, pattern string, recursive ...bool) [ // // It scans directory recursively if given parameter is true. func (r *Resource) doScanDir(path string, pattern string, recursive bool, onlyFile bool) []*File { + path = strings.Replace(path, "\\", "/", -1) if path != "/" { for path[len(path)-1] == '/' { path = path[:len(path)-1]