Opened 15 years ago

Last modified 15 years ago

#253 closed defect (FIXED)

Filename extensions should be made lowercase on disk

Reported by: Aleksej Owned by: Inconexo ø
Priority: trivial Milestone: 0.2.0
Component: programming Keywords:
Cc: Parent Tickets:

Description

"medium" and "thumbnail" versions of JPEG files are stored with a lowercase ".jpg" name extension, but the original versions are stored with whatever case was in the original file name: jpg, JPG, jpG…

So you get something like this:

user_dev/media/public/media_entries/fa23ab31abf7ec67be8000001:
 originalFileName.JpG
 medium.jpg
 thumbnail.jpg

(If the file has a random extension like "dfsg", it is simply not accepted.)

The extension should be made lowercase, so that all sizes have the same extension both on disk and when downloading.

Change History (15)

comment:1 by Aleksej, 15 years ago

Aleksej Serdjukov wrote:

was in the original file name: jpg, JPG, jpG…

or "JPeG", too (medium.jpg and thumbnail.jpg are still with "jpg")

comment:2 by Christopher Allan Webber, 15 years ago

Simple task, marked as "2 hours"

comment:3 by Inconexo ø, 15 years ago

I just tried and found:

IMG_0111.JPG medium.JPG thumbnail.JPG

All the same (uppercase) extension. Still needed to lowercase?

comment:4 by Aleksej, 15 years ago

(It looks like your original file had it uppercase: "JPG".)

Lowercase is still better though: it doesn't require holding Shift. :)

comment:5 by Inconexo ø, 15 years ago

It's not how you usually have to write it.

Anyway, in case we convert to lowercase, should we convert also original filename? Only extension? Because if the problem was the consistency between different versions (which I don't understand, anyway), we should do that?

comment:6 by Inconexo ø, 15 years ago

So, which is the desired behaviour?

Let's say I upload the image IMG_0111.JPG. How should the server store the files:

Option 1 (respect original case): IMG_0111.JPG medium.JPG thumbnail.JPG

Option 2 (generated files lowercase): IMG_0111.JPG medium.jpg thumbnail.jpg

Option 3 (all extensions lowercase): IMG_0111.jpg medium.jpg thumbnail.jpg

Option 4 (all filename lowercase): img_0111.jpg medium.jpg thumbnail.jpg

I don't have any reason to think that an option is better than the others, provide the user usually don't need to type the filename. But an option should be picked, for the ticket to be solved.

comment:7 by Aleksej, 15 years ago

Option 3.

You don't have to type it until you save the image to your computer.

comment:8 by Inconexo ø, 15 years ago

Well, actually, due to tab completion, extension is rarely typed. And I see a problem when you download an image with a name different to the one uploaded, which could lead to duplicated image files.

Anyway, enough talking. I pushed the changes that implements option 3.

repo: [https://gitorious.org/inconexo/mediagoblin/inconexos-mediagoblin](https://gitorious.org/inconexo/mediagoblin/inconexos-mediagoblin) branch: 588_lowercase_extension

comment:9 by Inconexo ø, 15 years ago

Owner: set to Inconexo ø

comment:9 by Aleksej, 15 years ago

Well, actually, due to tab completion, extension is rarely typed.

*.jpg

And I see a problem when you download an image with a name different to the one uploaded, which could lead to duplicated image files.

True.

Thanks.

comment:10 by Inconexo ø, 15 years ago

Status: NewFeedback

comment:10 by Christopher Allan Webber, 15 years ago

I am personally a big fan of option #3.

comment:11 by Christopher Allan Webber, 15 years ago

Rationale is that it makes things consistent and easy, but there's no need to mess with the rest of the filename.

comment:12 by Elrond, 15 years ago

Milestone: 0.2.0
Status: FeedbackClosed

Inconexo implemented Option 3. I merged it and pushed it. (wasn't easy after the video branch merging)

I think, is bug is done for now.

p.s.: I find Option 3 a bit inconsistent, because the original filename is a bit strange. But it's not so important to me anyway.

comment:13 by Will Kahn-Greene, 14 years ago

The original url for this bug was http://bugs.foocorp.net/issues/588 .

Note: See TracTickets for help on using tickets.