https://bugzilla.wikimedia.org/show_bug.cgi?id=4421





--- Comment #32 from Rob Lanphier (RobLa) <[email protected]>  2009-10-19 
06:25:01 UTC ---
Created an attachment (id=6680)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=6680)
Incomplete attempt to allow image moves to arbitrary names

Patch attached for an initial incomplete implementation.  It seems to work with
my very limited testing.  Note: I added a new config setting
($wgCheckFileExtensions) which needs to be set to "false" in order to use this
(default is "true").

In reply to comment #28 (great feedback, btw):
> I agree getNameFromTitle is bad.  I'd suggest it would be better to add a new
> accessor File::getNameOnDisk as an alternative to File::getName, and then
> change the URL constructors to use the former rather than the latter. 

Okee doke.  I added File::getFilename, and changed a few calls to point to
that.  I had to add a corresponding FileRepo::getFilenameFromTitle.

> Assuming your goal was to use MIME type to determine the appropriate 
> extension,
> then that won't work.  Because we have allowed capitalization variations, e.g.
> Foo.JPG != Foo.jpg != Foo.jpeg, there is no way to uniquely determine what the
> extension should be from the type.

It's possible, and the attached patch does it in a pretty reasonable way
(adding a new "getPreferredExtensionForType" that leverages some existing
normalization code).

However, I concur that this isn't the best solution.  The problem with it is
that an innocent reconfiguration could render the files inaccessible.

> Almost certainly we will need to add an
> extension field to the Image and Oldimage tables and simply look up the
> extension.  An advantage of this is that one could set all existing files to
> have a null extension, meaning that nothing needs to be added to the file name
> as already exists.

I ran out of time before I could implement this, but that would seem to be the
next logical step in all of this.  I still think we'll need the logic for
generating an extension from a MIME type, in the event that the initial
uploaded file name doesn't match the MIME type we'll need to get an extension
from somewhere.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to