Skip to content

Commit afeb172

Browse files
committed
Update web links to match new server URL format
1 parent cac03ae commit afeb172

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

internal/api/request/printer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ func PrintPackagePopularities(writer io.Writer, ppl PackagePopularityList) {
2828

2929
func PrintSearchURL(writer io.Writer, baseURL string, query string) {
3030
if len(query) > 0 {
31-
fmt.Fprintf(writer, "See more results at %s/packages#query=%s\n", baseURL, query)
31+
fmt.Fprintf(writer, "See more results at %s/packages?query=%s\n", baseURL, url.QueryEscape(query))
3232
}
3333
}
3434

3535
func PrintShowURL(writer io.Writer, baseURL string, packages []string) {
3636
if len(packages) > 0 {
3737
for i, p := range packages {
38-
packages[i] = url.QueryEscape(p)
38+
packages[i] = url.PathEscape(p)
3939
}
4040

4141
sort.StringSlice.Sort(packages)
42-
fmt.Fprintf(writer, "See more results at %s/compare/packages#packages=%s\n", baseURL, strings.Join(packages, ","))
42+
fmt.Fprintf(writer, "See more results at %s/compare/packages/%s\n", baseURL, strings.Join(packages, ","))
4343
}
4444
}

internal/api/request/printer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestPrintSearchURL(t *testing.T) {
2525

2626
output := buffer.String()
2727

28-
if !regexp.MustCompile(`\s+/foo/packages#query=bar\s+`).MatchString(output) {
28+
if !regexp.MustCompile(`\s+/foo/packages\?query=bar\s+`).MatchString(output) {
2929
t.Errorf("Unexpected output %s", output)
3030
}
3131
}
@@ -36,7 +36,7 @@ func TestPrintShowURL(t *testing.T) {
3636

3737
output := buffer.String()
3838

39-
if !regexp.MustCompile(`\s+/foo/compare/packages#packages=bar,baz\s+`).MatchString(output) {
39+
if !regexp.MustCompile(`\s+/foo/compare/packages/bar,baz\s+`).MatchString(output) {
4040
t.Errorf("Unexpected output %s", output)
4141
}
4242
}

0 commit comments

Comments
 (0)