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

           Summary: Apache temp files have no extension blocking uploading
                    anything because of mime check
           Product: MediaWiki
           Version: 1.16.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: Normal
         Component: Uploading
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: wikime...@purplefoot.com
                CC: gpaum...@wikimedia.org, bryan.tongm...@gmail.com


I was getting an error about no file extension through the UI since my
apache/php config creates temp files in /tmp/ with no file extension.  So I can
up with a solution around the issues since it seems that MediaWiki requires a
file extension to allow an upload to complete.  This is more of a "I found a
bug for me, and I fixed here.  And here's how."  and you can tell me if that
was stupid or there was already way around this.

I added $mTempOrigName to the Base class, then set it in FromFile.  Then in
getTitle of the Base class if the tempname fails to produce a file extension I
test the original name to see if I can get an extension from that.  If so I
override the vars and thing continue like normal.

includes/upload/UploadBase.php

        protected $mTempPath, $mTempOrigName;
...
                list( $partname, $ext ) = $this->splitExtensions(
$this->mFilteredName );
        if (count($ext) == 0) { // extension was missing from apache temp file,
try original name
            list($t_partname,$t_ext) = $this->splitExtensions(
$this->mTempOrigName );
            if (count($t_ext) > 1) {
                $partname = $t_partname;
                $ext = $t_ext;
            }
        }

includes/upload/UploadFromFile.php
                if( !$desiredDestName )
                        $desiredDestName = $request->getFileName(
'wpUploadFile' );
        $this->mTempOrigName = $request->getFileName( 'wpUploadFile' );
                return $this->initializePathInfo(



Not sure if this helps anyone else but it fixes my last blocker to upgrading.

-- 
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
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to