Documentation ¶
Index ¶
- Constants
- Variables
- type ErrUnsupportedType
- type MaxSize
- type UploadConfig
- func (c UploadConfig) CleanupPost(post smolboard.Post)
- func (c UploadConfig) CleanupPosts(posts []*smolboard.Post)
- func (c UploadConfig) ContentTypeAllowed(ctype string) bool
- func (c UploadConfig) CreatePosts(headers []*multipart.FileHeader) ([]*smolboard.Post, error)
- func (c *UploadConfig) Validate() error
- func (c UploadConfig) WrapReader(r io.Reader) (*limread.LimitedReader, error)
Constants ¶
View Source
const MaxFiles = 128
Variables ¶
View Source
var ErrTooManyFiles = httperr.New(400, "too many files; max 128")
Functions ¶
This section is empty.
Types ¶
type ErrUnsupportedType ¶
type ErrUnsupportedType struct {
ContentType string
}
func (ErrUnsupportedType) Error ¶
func (err ErrUnsupportedType) Error() string
func (ErrUnsupportedType) StatusCode ¶
func (err ErrUnsupportedType) StatusCode() int
type MaxSize ¶
type MaxSize struct {
// contains filtered or unexported fields
}
MaxSize contains a list of size overrides. A zero-value instance is a valid instance.
func (*MaxSize) UnmarshalTOML ¶
type UploadConfig ¶
type UploadConfig struct { FileDirectory string `toml:"fileDirectory"` MaxFileSize datasize.ByteSize `toml:"maxFileSize"` AllowedTypes []string `toml:"allowedTypes"` MaxSize MaxSize }
func NewConfig ¶
func NewConfig() UploadConfig
func (UploadConfig) CleanupPost ¶
func (c UploadConfig) CleanupPost(post smolboard.Post)
CleanupPost cleans up a single post asynchronously.
func (UploadConfig) CleanupPosts ¶
func (c UploadConfig) CleanupPosts(posts []*smolboard.Post)
CleanupPosts cleans up posts asynchronously.
func (UploadConfig) ContentTypeAllowed ¶
func (c UploadConfig) ContentTypeAllowed(ctype string) bool
func (UploadConfig) CreatePosts ¶
func (c UploadConfig) CreatePosts(headers []*multipart.FileHeader) ([]*smolboard.Post, error)
func (*UploadConfig) Validate ¶
func (c *UploadConfig) Validate() error
func (UploadConfig) WrapReader ¶
func (c UploadConfig) WrapReader(r io.Reader) (*limread.LimitedReader, error)
WrapReader wraps the given reader and restrict its MIME type as well as file size.
Directories ¶
Path | Synopsis |
---|---|
Package atomdl provides helper functions to allow atomic file downloads.
|
Package atomdl provides helper functions to allow atomic file downloads. |
Click to show internal directories.
Click to hide internal directories.