pathutil

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package pathutil hosts the URL-path helpers shared by route registration and tenant resolution. The functions preserve the exact semantics that server/route_registrar.go relied on before extraction, so existing callers behave identically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureLeadingSlash

func EnsureLeadingSlash(path string) string

func NormalizePrefix

func NormalizePrefix(prefix string) string

NormalizePrefix produces the canonical form expected by StripPathPrefix: inputs "" and "/" both collapse to "" so an empty prefix never matches a real path.

func StripPathPrefix

func StripPathPrefix(path, prefix string) (string, bool)

StripPathPrefix returns the part of path that follows prefix when path is under prefix (equals it exactly or has "prefix/" as its head), guarding against partial-word matches.

When ok is false, the returned string is the original path unchanged, not "" — callers can pass through StripPathPrefix without losing input.

Types

This section is empty.

Jump to

Keyboard shortcuts

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