Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2021-12-03 09:17:20 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-12-08 04:21:28 +0300
commitd9c27aea72fb9ef1dcfe3c8fb4ecface8400e534 (patch)
treee350cb49680919441358f9317cd01fce1491a604 /internal/serving
parentdd775b7a27aabc4c562b01a1480f147fb6d4a88b (diff)
fix(vfs): handle context.Canceled errors
As not found resources to reduce the number of 500 errors reported in the logs and Sentry. Closes https://gitlab.com/gitlab-org/gitlab-pages/-/issues/669. Changelog: changed.
Diffstat (limited to 'internal/serving')
-rw-r--r--internal/serving/disk/reader.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go
index 61316509..258df3bc 100644
--- a/internal/serving/disk/reader.go
+++ b/internal/serving/disk/reader.go
@@ -251,6 +251,11 @@ func (reader *Reader) serveCustomFile(ctx context.Context, w http.ResponseWriter
// Open and serve content of file
file, err := root.Open(ctx, fullPath)
if err != nil {
+ // Handle context.Canceled error as not exist https://gitlab.com/gitlab-org/gitlab-pages/-/issues/669
+ if errors.Is(err, context.Canceled) {
+ return fs.ErrNotExist
+ }
+
return err
}
defer file.Close()