Opened 7 years ago

Closed 6 years ago

Last modified 3 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:


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) (1.5 KB) - added by emperorcezar 7 years ago.

Download all attachments as: .zip

Change History (15)

Changed 7 years ago by emperorcezar

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

  • Component changed from Uncategorized to Database wrapper
  • Has patch set
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

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

comment:2 Changed 7 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from new to closed

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 7 years ago by emperorcezar

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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 7 years ago by jacob

  • Triage Stage changed from Design decision needed to Accepted

comment:5 Changed 7 years ago by Gulopine

  • Keywords fs-rf added

comment:6 Changed 7 years ago by Gulopine

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

comment:7 Changed 6 years ago by Gulopine

  • milestone set to 1.0 beta

comment:8 Changed 6 years ago by daviddahl

  • Owner changed from nobody to daviddahl
  • Status changed from reopened to new

I will write some tests for this patch

comment:9 Changed 6 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 6 years ago by Gulopine

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 6 years ago by daviddahl

  • Owner changed from daviddahl to nobody

Ok, cool thanks for the info.

comment:12 Changed 6 years ago by anonymous

  • Cc emperorcezar@… added

comment:13 Changed 6 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

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 3 years ago by jacob

  • milestone 1.0 beta deleted

Milestone 1.0 beta deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.