Skip to content

Check for invalid characters instead of escaping #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions go/porcelain/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"hash"
"io"
"io/ioutil"
"net/url"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -179,6 +178,12 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
}
return nil, err
}
for name := range files.Files {
if strings.ContainsAny(name, "#?") {
return nil, fmt.Errorf("Invalid filename '%s'. Deployed filenames cannot contain # or ? characters", name)
}
}

options.files = files

functions, err := bundle(options.FunctionsDir, options.Observer)
Expand Down Expand Up @@ -399,7 +404,7 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl

switch t {
case fileUpload:
name := (&url.URL{Path: f.Name}).EscapedPath()
name := f.Name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this var seems unneeded now

params := operations.NewUploadDeployFileParams().WithDeployID(d.ID).WithPath(name).WithFileBody(f)
if timeout != 0 {
params.SetTimeout(timeout)
Expand Down