Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAndValidateProjectFromPath ¶
func GetAndValidateProjectFromPath(path string, userID int, projectStore stor.ProjectStor) (*mcmodel.Project, error)
GetAndValidateProjectFromPath retrieves the project by extracting the project slug from the path, and asking the project store for that project. It also validates that the userID passed in has access to the project.
func GetMimeType ¶
GetMimeType will determine the type of file from its extension. It strips out the extra information such as the charset and just returns the underlying type. It returns "unknown" for the mime type if the mime package is unable to determine the type.
func GetProjectSlugFromPath ¶
GetProjectSlugFromPath extracts the project slug from the beginning of the path. For example /my-project/this/that has a project slug of "my-project".
func RemoveProjectSlugFromPath ¶
RemoveProjectSlugFromPath removes the slug project name from the path. For example the slug project name might be my-project-acf4. All paths will be prefixed with /my-project-acf4. So if the path is /my-project-acf4/file.txt then this method will return /file.txt
Types ¶
type Stores ¶
type Stores struct { FileStore stor.FileStor ProjectStore stor.ProjectStor ConversionStore stor.ConversionStor }
Stores is a place to consolidate the various stores that are used by the handlers. It allows the stores to be easily created and cleans up the number of parameters that need to be passed in to create a mcscp.Handler or mcsftp.Handler.