virtualpath

package
v2.11.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: GPL-3.0 Imports: 5 Imported by: 1 module, 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 ContainsControlChar

func ContainsControlChar(s string) bool

ContainsControlChar checks if a string contains any control characters (0x00-0x1F, 0x7F) Returns true if control characters are found (invalid for URLs)

func CreateVirtualPath

func CreateVirtualPath(scheme, id, name string) string

CreateVirtualPath creates a properly encoded virtual path for media Example: "kodi-show", "123", "Some Hot/Cold" -> "kodi-show://123/Some%20Hot%2FCold" Both id and name are URL-encoded to ensure round-trip compatibility with ParseVirtualPathStr Note: Simple alphanumeric IDs like "123" or "monkey1" remain unchanged after encoding

func ExtractSchemeID

func ExtractSchemeID(virtualPath, expectedScheme string) (string, error)

ExtractSchemeID extracts the ID component from a scheme-based virtual path with proper URL decoding. Returns error if the path doesn't match the expected scheme. Example: ExtractSchemeID("steam://123/Game%20Name", "steam") -> "123", nil

func IsValidScheme

func IsValidScheme(scheme string) bool

IsValidScheme validates that a scheme follows RFC 3986 rules: - Must start with a letter - Can contain letters, digits, '+', '-', '.'

Types

type URIComponents

type URIComponents struct {
	Scheme string
	Rest   string // Everything after ://
	Query  string
}

URIComponents holds parsed URI components

func ParseURIComponents

func ParseURIComponents(uri string) URIComponents

ParseURIComponents manually parses a URI into its components Note: Does not extract fragments - they remain part of name/query for custom schemes Returns empty result if URI contains control characters or has invalid scheme

type VirtualPathResult

type VirtualPathResult struct {
	Scheme string
	ID     string
	Name   string
}

VirtualPathResult holds parsed virtual path components

func ParseVirtualPathStr

func ParseVirtualPathStr(virtualPath string) (VirtualPathResult, error)

ParseVirtualPathStr parses a virtual path and returns its components with string ID Virtual path format: scheme://id/name (e.g., "steam://123/Game%20Name") Maps to URL structure: scheme://host/path where host=id, path=name Uses manual parsing to handle malformed URLs gracefully

Jump to

Keyboard shortcuts

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