Skip to content

Commit b59cd63

Browse files
authored
Merge pull request cli#5173 from joshmgross/joshmgross/gist-path-handling
Correctly handle Windows paths when creating gists
2 parents 4f0264e + f43574b commit b59cd63

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/cmd/gist/create/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"io"
99
"io/ioutil"
1010
"net/http"
11-
"path"
11+
"path/filepath"
1212
"regexp"
1313
"sort"
1414
"strings"
@@ -215,7 +215,7 @@ func processFiles(stdin io.ReadCloser, filenameOverride string, filenames []stri
215215
return fs, fmt.Errorf("failed to read file %s: %w", f, err)
216216
}
217217

218-
filename = path.Base(f)
218+
filename = filepath.Base(f)
219219
}
220220

221221
fs[filename] = &shared.GistFile{

pkg/cmd/gist/create/create_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"encoding/json"
66
"io/ioutil"
77
"net/http"
8-
"path"
8+
"path/filepath"
99
"strings"
1010
"testing"
1111

@@ -163,9 +163,9 @@ func TestNewCmdCreate(t *testing.T) {
163163

164164
func Test_createRun(t *testing.T) {
165165
tempDir := t.TempDir()
166-
fixtureFile := path.Join(tempDir, "fixture.txt")
166+
fixtureFile := filepath.Join(tempDir, "fixture.txt")
167167
assert.NoError(t, ioutil.WriteFile(fixtureFile, []byte("{}"), 0644))
168-
emptyFile := path.Join(tempDir, "empty.txt")
168+
emptyFile := filepath.Join(tempDir, "empty.txt")
169169
assert.NoError(t, ioutil.WriteFile(emptyFile, []byte(" \t\n"), 0644))
170170

171171
tests := []struct {

0 commit comments

Comments
 (0)