archivepath

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package archivepath decides which names and symbolic-link targets of a tar archive may be written into one extraction tree.

Archive names are slash paths by the tar format, not host paths, so this package uses package path throughout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLink(name, target string) error

CheckLink reports whether a symbolic link at slash path name of an archive may carry target. The target is relative, resolves inside the archive root, and has no ".." after a name.

The last rule is what keeps the text of a target equal to where it resolves. A name in the target may itself be a link, and "z/.." then reaches a different directory than its text says: with z a link to ".", each "z/.." climbs one directory more than it reads, so a target that passes the lexical check can resolve above the root. A target that climbs only before it names anything resolves the same however the rest of the tree's links point, provided no entry's location passes through a link (the extraction in coding/extension/host/cellpack checks the tree on disk for that). A target holds no ":": on Windows "C:foo" is relative to the current folder of drive C, an absolute path that filepath.IsAbs does not report on other systems.

func Member

func Member(name string) (string, error)

Member returns name as a clean relative slash path inside the archive root, or an error when it is absolute or escapes the root.

Types

This section is empty.

Jump to

Keyboard shortcuts

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