akkudoktoreos.server.dash.context.safe_asset_path

akkudoktoreos.server.dash.context.safe_asset_path(filepath: str) Path

Return a safe filesystem path for an asset under dash/assets/.

This prevents directory traversal attacks by restricting paths to the assets folder.

Parameters:

filepath (str) – Relative asset path requested by the client.

Returns:

Absolute Path object pointing to the asset file.

Return type:

Path

Raises:

ValueError – If the filepath attempts to traverse directories using ‘../’.