Skip to content

net/http: serveContent should 500 instead of 404 on error #10283

Closed
@bradfitz

Description

@bradfitz

http's fs.go contains:

        f, err := fs.Open(name)
        if err != nil {
                // TODO expose actual error?                                                                                                                                                
                NotFound(w, r)
                return
        }
        defer f.Close()

        d, err1 := f.Stat()
        if err1 != nil {
                // TODO expose actual error?                                                                                                                                                
                NotFound(w, r)
                return
        }

This bug is about those TODOs.

We should send a 500 instead of a 404. Sending the actual error text is probably too risky (might contain sensitive information). Instead, we could just log it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions