Opened 11 years ago

Last modified 11 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.



Subtickets

Change History (15)

comment:1 Changed 11 years ago by Aleksej

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 Changed 11 years ago by Christopher Allan Webber

Simple task, marked as "2 hours"



comment:3 Changed 11 years ago by Inconexo ø

I just tried and found:

IMG\_0111.JPG
medium.JPG
thumbnail.JPG

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



comment:4 Changed 11 years ago by Aleksej

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

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



comment:5 Changed 11 years ago by Inconexo ø

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 Changed 11 years ago by Inconexo ø

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 Changed 11 years ago by Aleksej

Option 3.

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



comment:8 Changed 11 years ago by Inconexo ø

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/\ :sub:`inconexo/mediagoblin/inconexos-mediagoblin](https://gitorious.org/`\ inconexo/mediagoblin/inconexos-mediagoblin)
branch: 588\_lowercase\_extension



comment:9 Changed 11 years ago by Inconexo ø

Owner: set to Inconexo ø

comment:9 Changed 11 years ago by Aleksej

    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 Changed 11 years ago by Inconexo ø

Status: NewFeedback

comment:10 Changed 11 years ago by Christopher Allan Webber

I am personally a big fan of option `#3 </issues/3>`_.



comment:11 Changed 11 years ago by Christopher Allan Webber

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



comment:12 Changed 11 years ago by Elrond

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 Changed 11 years ago by Will Kahn-Greene

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

Note: See TracTickets for help on using tickets.