Skip to content

Commit

Permalink
Escape all regexp metacharacters on read dir (Issue #49)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed May 4, 2019
1 parent 21a26bb commit d7a9e9e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/server/ftp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"regexp"
"time"

"github.com/ftpgrab/ftpgrab/internal/logging"
Expand Down Expand Up @@ -77,7 +78,7 @@ func (c *Client) Common() model.Common {

// ReadDir fetches the contents of a directory, returning a list of os.FileInfo's
func (c *Client) ReadDir(path string) ([]os.FileInfo, error) {
return c.ftp.ReadDir(path)
return c.ftp.ReadDir(regexp.QuoteMeta(path))
}

// Retrieve file "path" from server and write bytes to "dest".
Expand Down

0 comments on commit d7a9e9e

Please sign in to comment.