MCPcopy Index your code
hub / github.com/perkeep/perkeep / serveDownload

Method serveDownload

pkg/server/ui.go:523–537  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

521}
522
523func (ui *UIHandler) serveDownload(w http.ResponseWriter, r *http.Request) {
524 if ui.root.Storage == nil {
525 http.Error(w, "No BlobRoot configured", 500)
526 return
527 }
528
529 dh := &DownloadHandler{
530 // TODO(mpl): for more efficiency, the cache itself should be a
531 // blobpacked, or really anything better optimized for file reading
532 // than a blobserver.localdisk (which is what ui.Cache most likely is).
533 Fetcher: cacher.NewCachingFetcher(ui.Cache, ui.root.Storage),
534 Search: ui.search,
535 }
536 dh.ServeHTTP(w, r)
537}
538
539func (ui *UIHandler) importShare(w http.ResponseWriter, r *http.Request) {
540 if ui.shareImporter == nil {

Callers 1

ServeHTTPMethod · 0.95

Calls 3

ServeHTTPMethod · 0.95
NewCachingFetcherFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected