mapsslug

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mapsslug owns the namespaced slug grammar for offline-map downloads. Both pkg/webapi and pkg/mapscache import this package, so the regex, length cap, and forbidden-country list live in exactly one place.

Grammar:

state/<state-slug>
country/<iso2>           (iso2 != cn|ru)
province/<iso2>/<slug>   (iso2 != cn|ru)

state-slug and province-slug: ^[a-z][a-z0-9-]{0,49}$ iso2: ^[a-z]{2}$

The grammar is deliberately strict so an attacker cannot reach R2 or the local cache filesystem with a path-traversal payload. Catalog membership is checked separately against the live catalog.

Index

Constants

View Source
const MaxLen = 80

Variables

This section is empty.

Functions

func LeafRegexp

func LeafRegexp() *regexp.Regexp

LeafRegexp returns the slug-leaf regex for callers that need to apply it to a non-namespaced string (e.g. legacy on-disk filenames during migration).

func Parse

func Parse(s string) (kind, a, b string, ok bool)

Parse validates s against the grammar. Returns (kind, partA, partB, ok). For state and country, partB is "".

Types

This section is empty.

Jump to

Keyboard shortcuts

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