Skip to main content

Tiny filename sanitizer for uploads

Project description

filesafe

Minimal helper to sanitize filenames before uploading (e.g., to S3).

API:

  • safe_filename(name: str, max_len: int = 100, default: str = "file", ascii_only: bool = True) -> str

Example:

from filesafe import safe_filename
safe = safe_filename(" My Report (final).PDF ")
# "My_Report_final.pdf"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filesafe_sanitization-0.1.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filesafe_sanitization-0.1.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file filesafe_sanitization-0.1.0.tar.gz.

File metadata

  • Download URL: filesafe_sanitization-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for filesafe_sanitization-0.1.0.tar.gz
Algorithm Hash digest
SHA256 67e4a50a1ae04861c863e666f24dc21bf499535180e82c143f4fd22874e2f290
MD5 80832e7ebe52a0191bb09da97fedf0eb
BLAKE2b-256 c9fdf0e30cf64c471c8c006ac303836a8900e698c6d94dd642c9b778d6faae1a

See more details on using hashes here.

File details

Details for the file filesafe_sanitization-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for filesafe_sanitization-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1d2446f3acd41e7d2f9589249fd3c8aada716e37581dced729790c3cc90fc0c
MD5 bd2d2d1e5e2ebef75c50e724a73089a9
BLAKE2b-256 6fd9dd7e52886c2742e9d4c293d831113f4fcdd71f6ee409587fbf4e28c747b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page