Skip to content

Commit 3100187

Browse files
committed
hide potentially long query strings when printing urls
1 parent beeb35e commit 3100187

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

command/issue.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,11 @@ func issueCreate(cmd *cobra.Command, args []string) error {
353353
url.QueryEscape(body),
354354
)
355355
// TODO could exceed max url length for explorer
356-
fmt.Fprintf(cmd.ErrOrStderr(), "Opening %s in your browser.\n", openURL)
356+
url, err := url.Parse(openURL)
357+
if err != nil {
358+
return err
359+
}
360+
fmt.Fprintf(cmd.ErrOrStderr(), "Opening %s%s in your browser.\n", url.Host, url.Path)
357361
return utils.OpenInBrowser(openURL)
358362
} else if action == SubmitAction {
359363
params := map[string]interface{}{

command/pr_create.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ func prCreate(cmd *cobra.Command, _ []string) error {
148148
url.QueryEscape(title),
149149
url.QueryEscape(body),
150150
)
151-
// TODO maybe do something about -d being discarded when previewing
152151
// TODO could exceed max url length for explorer
153-
fmt.Fprintf(cmd.ErrOrStderr(), "Opening %s in your browser.\n", openURL)
152+
url, err := url.Parse(openURL)
153+
if err != nil {
154+
return err
155+
}
156+
fmt.Fprintf(cmd.ErrOrStderr(), "Opening %s%s in your browser.\n", url.Host, url.Path)
154157
return utils.OpenInBrowser(openURL)
155-
156158
} else {
157159
panic("Unreachable state")
158160
}

0 commit comments

Comments
 (0)