Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#5485 closed (wontfix)

Changing repetitive uploaded files from underscores to numbers

Reported by: emperorcezar Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: fs-rf-docs
Cc: emperorcezar@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently The filefield adds an underscore if you upload to a file that already exists. This leads to files like file_.txt
This is annoying. The patch sets the system to create files file.txt, file_2.txt ..... file_99.txt etc.

Attachments (1)

base.py.diff (1.5 KB) - added by emperorcezar 9 years ago.

Download all attachments as: .zip

Change History (15)

Changed 9 years ago by emperorcezar

Attachment: base.py.diff added

comment:1 Changed 9 years ago by deepak <deep.thukral@…>

Component: UncategorizedDatabase wrapper
Has patch: set
Needs documentation: unset
Needs tests: set
Patch needs improvement: unset
Triage Stage: UnreviewedDesign decision needed

What is the problem with underscore? Its simple, fast and effective.

comment:2 Changed 9 years ago by James Bennett

Resolution: wontfix
Status: newclosed

Every solution to this problem will annoy someone; if we switch it to numbers, someone who liked the underscores will complain. Since this is essentially arbitrary, and since Django's already picked a solution, I'm going to wontfix this.

comment:3 Changed 9 years ago by emperorcezar

Resolution: wontfix
Status: closedreopened

The issue is two-fold. First, some systems have a character limit on filenames (255 on BSD if I remember). Second, it's difficult to manually and visually distinguish between underscored files. Put 30 avatar_.jpg files like avatar.jpg avatar_.jpg. Then when one has to delete the correct one by hand for some reason, a mistake becomes extremely easy vs deleting avatar_15.jpg Also, at what point will the database max out on the file length? It is my opinion that the repeated underscore may be simple and fast, but they are by far not effective when an application has to scale.

comment:4 Changed 9 years ago by Jacob

Triage Stage: Design decision neededAccepted

comment:5 Changed 9 years ago by Marty Alchin

Keywords: fs-rf added

comment:6 Changed 9 years ago by Marty Alchin

Keywords: fs-rf-docs added; fs-rf removed

comment:7 Changed 8 years ago by Marty Alchin

milestone: 1.0 beta

comment:8 Changed 8 years ago by daviddahl

Owner: changed from nobody to daviddahl
Status: reopenednew

I will write some tests for this patch

comment:9 Changed 8 years ago by daviddahl

With Trunk SVN: Last Changed Rev: 7950

I cannot apply this patch to attempt writing tests:

patch: Only garbage was found in the patch input.

Very strange.

comment:10 Changed 8 years ago by Marty Alchin

With #5361, this behavior will be made quite easy, and its documentation will explain how to do it. In fact, there's already a test on that patch making sure that Trac-style file numbering (filename.3.txt, etc) works just fine. I've left this ticket open so we can keep of everything that #5361 is looking to address, but any fixes to this will be applied in that ticket instead.

The fs-rf-docs keyword here means that the docs on #5361 will explain how to do it, but it won't be enabled by default. There's certainly a case for changing it, and it would be backwards-compatible, since existing filenames are already stored in the database, but at the moment I'm not planning to change the default behavior.

comment:11 Changed 8 years ago by daviddahl

Owner: changed from daviddahl to nobody

Ok, cool thanks for the info.

comment:12 Changed 8 years ago by anonymous

Cc: emperorcezar@… added

comment:13 Changed 8 years ago by Jacob

Resolution: wontfix
Status: newclosed

File storage is in as of [8244], so I'm marking this as wontfix -- as Marty says, it's very easy to write a custom file storage backend that works exactly how you like it.

comment:14 Changed 5 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top