attachments

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseURL added in v0.5.0

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

ParseURL validates the shared user-attachment URL format, without choosing an authentication host.

func PrewarmUploadHostDNS added in v0.4.3

func PrewarmUploadHostDNS(ctx context.Context, host string)

PrewarmUploadHostDNS resolves upload-host DNS in the background, DNS-only.

func StatUploadFile added in v0.5.0

func StatUploadFile(filePath string) (os.FileInfo, error)

StatUploadFile rejects inputs that cannot be streamed as regular files.

func SupportsTokenUpload added in v0.5.0

func SupportsTokenUpload(filePath string) bool

Types

type Asset

type Asset struct {
	ID           int64   `json:"id"`
	Name         string  `json:"name"`
	Size         int64   `json:"size"`
	ContentType  string  `json:"content_type"`
	Href         string  `json:"href"`
	OriginalName *string `json:"original_name"`
}

type RefererPage

type RefererPage struct {
	URL  string
	Meta refererPageMetadata
}

RefererPage carries the referer URL and the metadata parsed from its HTML at fetch time.

type RefererPageFetcher

type RefererPageFetcher interface {
	Fetch(ctx context.Context, client *web.Client) (*RefererPage, error)
}

func NewCommitHeadPageFetcher

func NewCommitHeadPageFetcher(host string, repoFullName string) RefererPageFetcher

func NewIssueNewPageFetcher

func NewIssueNewPageFetcher(host string, repoFullName string) RefererPageFetcher

type TokenUploader added in v0.5.0

type TokenUploader struct {
	// contains filtered or unexported fields
}

TokenUploader sends media to GitHub Cloud using gh API authentication.

func NewTokenUploader added in v0.5.0

func NewTokenUploader(host, token string, repositoryID int64, client *http.Client) (*TokenUploader, error)

func (*TokenUploader) Upload added in v0.5.0

func (u *TokenUploader) Upload(ctx context.Context, filePath string) (Asset, error)

type Uploader

type Uploader struct {
	// contains filtered or unexported fields
}

Uploader carries the shared session context for GitHub user-attachment uploads.

func NewUploader

func NewUploader(host string, session web.Session, client *http.Client) (*Uploader, error)

func (*Uploader) ResolveRefererPage

func (u *Uploader) ResolveRefererPage(ctx context.Context, fetchers []RefererPageFetcher) (*RefererPage, error)

func (*Uploader) Upload

func (u *Uploader) Upload(ctx context.Context, filePath string, refererPage *RefererPage, repositoryID int64) (Asset, error)

Jump to

Keyboard shortcuts

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