Code Room
Code reviewHardcr-g142
Subject Missing validationLevel Senior–Staff~24 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Go file-download endpoint.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewgo
func Download(w http.ResponseWriter, r *http.Request) {    name := r.URL.Query().Get("file")    path := filepath.Join("/srv/uploads", name)    data, err := os.ReadFile(path)    if err != nil {        http.Error(w, "not found", 404)        return    }    w.Header().Set("Content-Type", "application/octet-stream")    w.Write(data)}
Run or narrate your approach, then ask the coach.