tool

package
v3.59.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Tools               = make(map[string]Tool)
	MultipartExtensions = make(map[string]MultipartExtension)
)
View Source
var ErrArchiveIllegalPath = errors.New("archive entry has illegal path")

ErrArchiveIllegalPath indicates an archive entry path is unsafe for extraction.

Functions

func DecompressFromFolderTraversal added in v3.44.0

func DecompressFromFolderTraversal(r ArchiveReader, outputPath string, args model.ArchiveInnerArgs, up model.UpdateProgress) error

func GenerateMetaTreeFromFolderTraversal added in v3.44.0

func GenerateMetaTreeFromFolderTraversal(r ArchiveReader) (bool, []model.ObjTree)

func GetArchiveTool

func GetArchiveTool(ext string) (*MultipartExtension, Tool, error)

func MakeModelObj added in v3.44.0

func MakeModelObj(file os.FileInfo) *model.Object

func RegisterTool

func RegisterTool(tool Tool)

func SecureJoin added in v3.57.0

func SecureJoin(baseDir, entryName string) (string, error)

SecureJoin returns a safe extraction path for an archive entry. It rejects absolute paths, traversal, Windows drive/UNC paths, and NUL bytes.

Types

type ArchiveReader added in v3.44.0

type ArchiveReader interface {
	Files() []SubFile
}

type CanEncryptSubFile added in v3.44.0

type CanEncryptSubFile interface {
	IsEncrypted() bool
	SetPassword(password string)
}

type MultipartExtension added in v3.44.0

type MultipartExtension struct {
	PartFileFormat  string
	SecondPartIndex int
}

type SubFile added in v3.44.0

type SubFile interface {
	Name() string
	FileInfo() fs.FileInfo
	Open() (io.ReadCloser, error)
}

type Tool

type Tool interface {
	AcceptedExtensions() []string
	AcceptedMultipartExtensions() map[string]MultipartExtension
	GetMeta(ss []*stream.SeekableStream, args model.ArchiveArgs) (model.ArchiveMeta, error)
	List(ss []*stream.SeekableStream, args model.ArchiveInnerArgs) ([]model.Obj, error)
	Extract(ss []*stream.SeekableStream, args model.ArchiveInnerArgs) (io.ReadCloser, int64, error)
	Decompress(ss []*stream.SeekableStream, outputPath string, args model.ArchiveInnerArgs, up model.UpdateProgress) error
}

type WrapFileInfo added in v3.44.0

type WrapFileInfo struct {
	model.Obj
}

Jump to

Keyboard shortcuts

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