#35818: Failing to save file with long names containing dots
-------------------------------------+-------------------------------------
     Reporter:  Bruno Alla           |                    Owner:  Bruno
                                     |  Alla
         Type:  Bug                  |                   Status:  closed
    Component:  File                 |                  Version:  5.1
  uploads/storage                    |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

 * resolution:   => wontfix
 * status:  assigned => closed

Comment:

 Hello Bruno, thank you for your report and for providing the repro
 project; I appreciate it. I’ve investigated the issue and reviewed your
 PR.

 My conclusion is that the key concern here is how we define "all the file
 extensions" for a filename. The proposal in your PR, which suggests that
 any suffix shorter than 5 characters should be considered an extension,
 seems arbitrary and unpredictable. I'm not comfortable adding such a rule
 to Django core. Currently, Django follows the logic established by
 pathlib, which defines suffixes as everything after the first dot.

 Implementing any other algorithm would necessitate a comprehensive list of
 file extensions, which may not be practical (or possible!).

 I understand that the current path-splitting logic may not align with your
 project's specific needs, but I believe it does not apply to the broader
 Django ecosystem. Django is designed to provide robust solutions for
 common scenarios. Your project could achieve the desired behavior by
 either increasing the `max_length` of a `FileField`, validating filenames
 to restrict dots, or by renaming files proactively. You could also provide
 your custom `Storage` class.

 Given the above, I'll close the ticket accordingly, but if you disagree,
 you can consider starting a new conversation on the
 [https://forum.djangoproject.com/c/internals/5 Django Forum], where you'll
 reach a wider audience and likely get extra feedback. If there is a
 community conversation and consensus on a suitable solution is reached,
 please let me know and I'll be happy to re-open pointing to the Forum
 topic.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35818#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019268e3e4b6-3f604afc-6744-49ba-bfd0-d372ec8fdfa0-000000%40eu-central-1.amazonses.com.

Reply via email to