diff options
| author | Ethan Lee <ethanalee@google.com> | 2025-12-30 18:04:55 +0000 |
|---|---|---|
| committer | Nicholas Husin <nsh@golang.org> | 2025-12-30 12:17:19 -0800 |
| commit | 0432e49b609a4bb73d29a3dce9c89978a29f079b (patch) | |
| tree | 8b49129d2df85cfc884eda97fb6389f330361c16 | |
| parent | 1a3bd3c788fea11057a8e696fd274c4c3f3e952c (diff) | |
| download | go-x-pkgsite-0432e49b609a4bb73d29a3dce9c89978a29f079b.tar.xz | |
internal/frontend: remove logging for http.StatusNotFound
- Update fetchCodeWikiURL to treat http.StatusNotFound as a successful
"no link" result rather than an error. This prevents newURLGenerator
from logging an Errorf every time a package is missing from CodeWiki.
Change-Id: I05bc0361acba70791fc526e7fdc58d81e4602a73
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/733280
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
| -rw-r--r-- | internal/frontend/links.go | 4 | ||||
| -rw-r--r-- | tests/screentest/testcases.ci.txt | 2 | ||||
| -rw-r--r-- | tests/screentest/testdata/testcases.ci/vuln-stdlib-module-540x1080.want.png | bin | 114317 -> 113326 bytes | |||
| -rw-r--r-- | tests/screentest/testdata/testcases.ci/vuln-stdlib-module.want.png | bin | 154012 -> 153280 bytes | |||
| -rw-r--r-- | tests/screentest/testdata/testcases/badge.want.png | bin | 101225 -> 101232 bytes | |||
| -rw-r--r-- | tests/screentest/testdata/testcases/home.want.png | bin | 143534 -> 143484 bytes |
6 files changed, 6 insertions, 0 deletions
diff --git a/internal/frontend/links.go b/internal/frontend/links.go index c4cf8281..b435ff9b 100644 --- a/internal/frontend/links.go +++ b/internal/frontend/links.go @@ -134,6 +134,10 @@ func fetchCodeWikiURL(ctx context.Context, client *http.Client, path string, rec return "", err } defer resp.Body.Close() + // Handle 404 as a successful "not found" state rather than an error. + if resp.StatusCode == http.StatusNotFound { + return "", nil + } if resp.StatusCode != http.StatusOK { return "", errors.New(resp.Status) } diff --git a/tests/screentest/testcases.ci.txt b/tests/screentest/testcases.ci.txt index d37bcdfc..045f8dd6 100644 --- a/tests/screentest/testcases.ci.txt +++ b/tests/screentest/testcases.ci.txt @@ -48,6 +48,8 @@ capture fullscreen 540x1080 test vuln stdlib module path /archive/zip@go1.16.4 +eval {{$hideElements}} +sleep 3s capture viewport capture viewport 540x1080 diff --git a/tests/screentest/testdata/testcases.ci/vuln-stdlib-module-540x1080.want.png b/tests/screentest/testdata/testcases.ci/vuln-stdlib-module-540x1080.want.png Binary files differindex 44754955..4ac7973c 100644 --- a/tests/screentest/testdata/testcases.ci/vuln-stdlib-module-540x1080.want.png +++ b/tests/screentest/testdata/testcases.ci/vuln-stdlib-module-540x1080.want.png diff --git a/tests/screentest/testdata/testcases.ci/vuln-stdlib-module.want.png b/tests/screentest/testdata/testcases.ci/vuln-stdlib-module.want.png Binary files differindex 1d72608a..89fd936a 100644 --- a/tests/screentest/testdata/testcases.ci/vuln-stdlib-module.want.png +++ b/tests/screentest/testdata/testcases.ci/vuln-stdlib-module.want.png diff --git a/tests/screentest/testdata/testcases/badge.want.png b/tests/screentest/testdata/testcases/badge.want.png Binary files differindex af178292..c41c3c59 100644 --- a/tests/screentest/testdata/testcases/badge.want.png +++ b/tests/screentest/testdata/testcases/badge.want.png diff --git a/tests/screentest/testdata/testcases/home.want.png b/tests/screentest/testdata/testcases/home.want.png Binary files differindex cfab3ea6..572fc1f5 100644 --- a/tests/screentest/testdata/testcases/home.want.png +++ b/tests/screentest/testdata/testcases/home.want.png |
