Explorar o código

trim filepath quotes

fixes windows filepathes
Julien Schmidt %!s(int64=12) %!d(string=hai) anos
pai
achega
0e8690a9f2
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      infile.go

+ 2 - 1
infile.go

@@ -32,7 +32,7 @@ func init() {
 // Alternatively you can allow the use of all local files with
 // the DSN parameter 'allowAllFiles=true'
 func RegisterLocalFile(filepath string) {
-	fileRegister[filepath] = true
+	fileRegister[strings.Trim(filepath, `"`)] = true
 }
 
 // RegisterReaderHandler registers a handler function which is used
@@ -62,6 +62,7 @@ func (mc *mysqlConn) handleInFileRequest(name string) (err error) {
 			}
 		}
 	} else { // File
+		name = strings.Trim(name, `"`)
 		if fileRegister[name] || mc.cfg.params[`allowAllFiles`] == `true` {
 			rdr, err = os.Open(name)
 		} else {