Skip to content

Does this perform filename sanitation? #47

@Flimm

Description

@Flimm

I'm looking for filename sanitation. For example, Windows cannot correctly handle filenames containing <, >, :, ", /, \, |, ? or *, ASCII control characters or the null byte. In addition, Windows reserves some filenames, including CON, PRN, AUX, NUL and others. Filenames in Windows cannot end in a space or a dot. macOS and Linux have their own restrictions too.

Right now, the setting "keep_original_filename" can only be set to True or False. I propose these values instead:

  • "filenames": "keep" that behaves like "keep_original_filename": True
  • "filenames": "random" that behaves like "keep_original_filename": False
  • "filenames": "sanitize" that will sanitize the filenames using a library like pathvalidate

Does django-middleware-fileuploadvalidation provide this functionality already? Maybe I missed it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions