Skip to content

Commit 7704902

Browse files
coderabbitai[bot]CodeRabbit
andauthored
fix: apply CodeRabbit auto-fixes
Fixed 3 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
1 parent bc5657f commit 7704902

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See [Conventional Commits](https://www.conventionalcommits.org/) for commit mess
1414
The cache is now bounded and configurable via three environment variables:
1515
- `ATMOS_FS_GLOB_CACHE_MAX_ENTRIES` (default `1024`, minimum `16`) — maximum number of cached glob patterns.
1616
- `ATMOS_FS_GLOB_CACHE_TTL` (default `5m`, minimum `1s`) — time-to-live for each cache entry.
17-
Values below the respective minimums are clamped up rather than rejected.
17+
See `applyGlobCacheConfig` in `pkg/filesystem/glob.go` for the exact logic: only positive values below the minimums are clamped up to the floor; zero or negative values cause the code to fall back to the default values.
1818
- `ATMOS_FS_GLOB_CACHE_EMPTY` (default `1`) — set to `0` to skip caching patterns that match no files.
1919
- **`pkg/http.normalizeHost`**: now strips default ports (`:443`, `:80`) in addition to
2020
lower-casing and removing trailing dots, so that `api.github.com:443` is treated
@@ -37,4 +37,4 @@ See [Conventional Commits](https://www.conventionalcommits.org/) for commit mess
3737

3838
- Cross-host HTTP redirects (all five status codes: 301, 302, 303, 307, 308) no longer
3939
forward the `Authorization` header to the redirect target, preventing accidental token
40-
leakage via open redirects.
40+
leakage via open redirects.

errors/errors.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,10 @@ var (
248248
ErrInvalidPagerCommand = errors.New("invalid pager command")
249249
ErrEmptyURL = errors.New("empty URL provided")
250250
ErrFailedToFindImport = errors.New("failed to find import")
251-
ErrInvalidFilePath = errors.New("invalid file path")
252-
ErrRelPath = errors.New("error determining relative path")
253-
ErrHTTPRequestFailed = errors.New("HTTP request failed")
251+
ErrInvalidFilePath = errors.New("invalid file path")
252+
ErrRelPath = errors.New("error determining relative path")
253+
ErrHTTPRequestFailed = errors.New("HTTP request failed")
254+
ErrRedirectLimitExceeded = errors.New("stopped after 10 redirects")
254255

255256
// Config loading errors.
256257
ErrAtmosDirConfigNotFound = errors.New("atmos config directory not found")
@@ -1027,4 +1028,4 @@ type ExitCodeError struct {
10271028

10281029
func (e ExitCodeError) Error() string {
10291030
return fmt.Sprintf("subcommand exited with code %d", e.Code)
1030-
}
1031+
}

pkg/http/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func WithGitHubToken(token string) ClientOption {
9696
// different-port redirects are treated as cross-host, matching Go's own redirect policy.
9797
func stripAuthOnCrossHostRedirect(req *http.Request, via []*http.Request) error {
9898
if len(via) >= 10 {
99-
return errors.New("stopped after 10 redirects")
99+
return errUtils.ErrRedirectLimitExceeded
100100
}
101101
if len(via) > 0 && req.URL.Host != via[0].URL.Host {
102102
req.Header.Del("Authorization")
@@ -361,4 +361,4 @@ func Get(ctx context.Context, url string, client Client) ([]byte, error) {
361361
}
362362

363363
return body, nil
364-
}
364+
}

0 commit comments

Comments
 (0)