Skip to content

Commit

Permalink
gateway: remove workaround for go bugs on ranges on empty files
Browse files Browse the repository at this point in the history
golang/go@edfe078 was released in go1.20 and our `go.mod` file indicates:
```
go 1.20
```
So this is not needed anymore.
  • Loading branch information
Jorropo committed Jan 12, 2024
1 parent 76d9292 commit 7d9800d
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions gateway/handler_unixfs_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ func (i *handler) serveFile(ctx context.Context, w http.ResponseWriter, r *http.
// Set Content-Disposition
name := addContentDispositionHeader(w, r, rq.contentPath)

if fileSize == 0 {
// We override null files to 200 to avoid issues with fragment caching reverse proxies.
// Also whatever you are asking for, it's cheaper to just give you the complete file (nothing).
// TODO: remove this if clause once https://github.com/golang/go/issues/54794 is fixed in two latest releases of go
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
return true
}

var content io.Reader = fileBytes
// Calculate deterministic value for Content-Type HTTP header
// (we prefer to do it here, rather than using implicit sniffing in http.ServeContent)
Expand Down

0 comments on commit 7d9800d

Please sign in to comment.