We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b8c964 commit 2af136cCopy full SHA for 2af136c
pkg/cmd/gist/view/view.go
@@ -71,10 +71,16 @@ func viewRun(opts *ViewOptions) error {
71
return utils.OpenInBrowser(gistURL)
72
}
73
74
- u, err := url.Parse(opts.Selector)
75
- if err == nil {
76
- if strings.HasPrefix(u.Path, "/") {
77
- gistID = strings.Split(u.Path, "/")[2]
+ if strings.Contains(gistID, "/") {
+ u, err := url.Parse(opts.Selector)
+ if err == nil && strings.HasPrefix(u.Path, "/") {
+ split := strings.Split(u.Path, "/")
78
+
79
+ if len(split) > 2 && split[2] != "" {
80
+ gistID = strings.Split(u.Path, "/")[2]
81
+ } else {
82
+ return fmt.Errorf("Invalid gist URL %s", u)
83
+ }
84
85
86
0 commit comments