mc

package
v0.0.0-...-85acea7 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAndValidateProjectFromPath

func GetAndValidateProjectFromPath(path string, userID int, projectStore store.ProjectStore) (*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

func GetMimeType(name string) string

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

func GetProjectSlugFromPath(path string) string

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

func RemoveProjectSlugFromPath(path, projectSlug string) string

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       store.FileStore
	ProjectStore    store.ProjectStore
	ConversionStore store.ConversionStore
}

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.

func NewGormStores

func NewGormStores(db *gorm.DB, mcfsRoot string) *Stores

Jump to

Keyboard shortcuts

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