MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / handleStreamFile

Function handleStreamFile

pkg/web/web.go:337–350  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

335}
336
337func handleStreamFile(w http.ResponseWriter, r *http.Request) {
338 path := r.URL.Query().Get("path")
339 if path == "" {
340 http.Error(w, "path is required", http.StatusBadRequest)
341 return
342 }
343 no404 := r.URL.Query().Get("no404")
344 // path should already be formatted as a wsh:// URI (e.g. wsh://local/path or wsh://connection/path)
345 err := handleStreamFileFromReader(w, r, path, no404 != "")
346 if err != nil {
347 log.Printf("error streaming file %q: %v\n", path, err)
348 http.Error(w, fmt.Sprintf("error streaming file: %v", err), http.StatusInternalServerError)
349 }
350}
351
352func WriteJsonError(w http.ResponseWriter, errVal error) {
353 w.Header().Set(ContentTypeHeaderKey, ContentTypeJson)

Callers

nothing calls this directly

Calls 3

GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected