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





--- Comment #28 from Robert Rohde <[email protected]>  2009-10-18 09:41:42 
UTC ---
(In reply to comment #27)
<snip>

> I'm not even remotely sure if getNameFromTitle is the right place to insert
> this
> sort of thing (I suspect it isn't, actually).   I was looking for a place 
> where 
> I could muck with the file name without also mucking with other uses of the
> name.
> It seems safer to go elsewhere, like File::getRel and File::getUrlRel.  I may 
> play around more with this once I get unstuck.

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. 

> The wall I hit was figuring out the right way to pull the MIME type out of 
> the 
> database, because I think I accidently engaged in a mutually recursive death 
> spiral calling LocalFile::GetMimeType() from there.  If anyone has any tips on
> the right way to pull the mime type for a given Title out, that'd be most 
> helpful.

<snip>

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.  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.


-- 
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