filename

package
v0.43.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package filename owns display-name normalization shared by HTTP file transport. A display filename is never a filesystem path or a storage object key.

Index

Constants

View Source
const MaxBytes = 255

Variables

This section is empty.

Functions

func Extension

func Extension(name string) string

func Normalize

func Normalize(name, fallback string) string

Normalize removes path components, controls, invisible format/bidi marks and surrounding quotes. Long names retain a short safe extension and remain bounded valid UTF-8. Results own their bytes instead of retaining a larger incoming MIME header.

func StripInvisible

func StripInvisible(name string) string

StripInvisible removes zero-width and bidirectional formatting characters (U+200B–U+200F, U+202A–U+202E, U+2060–U+2064, U+2066–U+2069, U+061C and U+FEFF). They can hide or visually reorder a displayed name, for example making "invoice\u202Efdp.exe" render as "invoiceexe.pdf".

func Truncate

func Truncate(text string, limit int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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