MCPcopy
hub / github.com/kopia/kopia / maybeReadIndexBytes

Function maybeReadIndexBytes

internal/server/server.go:770–784  ·  view source on GitHub ↗
(fs http.FileSystem)

Source from the content-addressed store, hash-verified

768}
769
770func maybeReadIndexBytes(fs http.FileSystem) []byte {
771 rootFile, err := fs.Open("index.html")
772 if err != nil {
773 return nil
774 }
775
776 defer rootFile.Close() //nolint:errcheck
777
778 rd, err := io.ReadAll(rootFile)
779 if err != nil {
780 return nil
781 }
782
783 return rd
784}
785
786// ServeStaticFiles configures HTTP handler that serves static files and dynamically patches index.html to embed CSRF token, etc.
787func (s *Server) ServeStaticFiles(m *mux.Router, fs http.FileSystem) {

Callers 1

ServeStaticFilesMethod · 0.85

Calls 2

OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected