standard

package
v0.0.0-...-d124ba8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	http.File
}

File is the http.File use in FileSystem. It is used to wrap the Readdir method of http.File so that we can remove files and directories that start with a period from its output.

func (File) Readdir

func (f File) Readdir(n int) (fis []os.FileInfo, err error)

Readdir is a wrapper around the Readdir method of the embedded File that filters out all files that start with a period in their name.

func (File) Serve

func (f File) Serve(w http.ResponseWriter, r *http.Request)

Serve Calls http.ServeContent

type FileSystem

type FileSystem struct {
	base.FileSystem
	Dir    string
	Logger *log.Entry
}

FileSystem is an http.FileSystem that hides hidden "dot files" from being served.

func NewFileSystem

func NewFileSystem() FileSystem

NewFileSystem Initialise new FileSystem

func (FileSystem) Open

func (fs FileSystem) Open(name string) (base.ServingFile, error)

Open is a wrapper around the Open method of the embedded FileSystem that serves a 403 permission error when name has a file or directory with whose name starts with a period in its path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL