localio

package
v1.0.57 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package localio owns safe local artifact publication shared by product shortcuts. Remote names and URLs are always treated as untrusted input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveOutputPath

func ResolveOutputPath(baseDir, output, rawURL, preferredName string) (string, string, error)

func SafeFilename

func SafeFilename(preferredName, rawURL string) string

SafeFilename selects a portable basename from a preferred server name or URL.

func ValidateDownloadURL

func ValidateDownloadURL(rawURL string) (*url.URL, error)

ValidateDownloadURL accepts only public DingTalk and Aliyun OSS HTTPS hosts.

func ValidateOutput

func ValidateOutput(output string) error

ValidateOutput rejects absolute paths and portable `..` escapes.

Types

type DownloadOptions

type DownloadOptions struct {
	BaseDir       string
	Output        string
	PreferredName string
	Headers       map[string]string
}

DownloadOptions controls safe, atomic publication beneath BaseDir.

type DownloadResult

type DownloadResult struct {
	AbsolutePath string
	RelativePath string
	SizeBytes    int64
}

DownloadResult describes the published local artifact.

func Download

func Download(ctx context.Context, rawURL string, opts DownloadOptions) (DownloadResult, error)

Download validates a platform-owned HTTPS URL, resolves a workspace-relative output path without following symlink escapes, streams into a sibling temp file, fsyncs it, and atomically publishes the completed file.

Jump to

Keyboard shortcuts

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