Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix off-by-1 error in pmtiles mock bucket #148

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pmtiles/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
if len(etag) > 0 && resultEtag != etag {
return nil, "", 412, &RefreshRequiredError{}
}
if offset > int64(len(bs)) {
if offset >= int64(len(bs)) {
return nil, "", 416, &RefreshRequiredError{416}
}

Expand Down Expand Up @@ -111,7 +111,7 @@
return hasherToEtag(hasher)
}

func (b FileBucket) NewRangeReaderEtag(_ context.Context, key string, offset, length int64, etag string) (io.ReadCloser, string, int, error) {

Check warning on line 114 in pmtiles/bucket.go

View workflow job for this annotation

GitHub Actions / fmt_vet_lint

exported method FileBucket.NewRangeReaderEtag should have comment or be unexported
name := filepath.Join(b.path, key)
file, err := os.Open(name)
defer file.Close()
Expand Down
Loading