Skip to main content

Module sanitize

Module sanitize 

Source
Expand description

Input sanitisation for file paths and URLs.

Guards against:

  • Directory traversal in filenames originating from Immich API responses
  • Non-HTTP(S) URL schemes in user-provided server addresses

Functionsยง

safe_filename
Strip a filename to its final component and reject traversal attempts.
validate_http_url
Validate that a URL string uses an HTTP or HTTPS scheme.