-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.help wanted
Milestone
Description
The fs.FS
argument, passed to the functions http.ServeFileFS
, http.FileServerFS
, and http.NewFileTransportFS
, must implement io.Seeker
. However, this requirement is not documented in these functions.
If io.Seeker
is not implemented, these functions may fail to serve files and instead could send a 500 error to the client. Here is the code from the serveContent
function where the error is returned:
Lines 248 to 252 in 2073b35
_, err := content.Seek(0, io.SeekStart) // rewind to output whole file | |
if err != nil { | |
Error(w, "seeker can't seek", StatusInternalServerError) | |
return | |
} |
This error can be tricky to detect as it only appears if the "Content-Type" header of the response hasn’t been set earlier.
Note that the issue #44553 is similar, but unlike the current issue, it identifies it as a problem in the serveContent
and suggests changing it.
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.help wanted