* Upload warnings now show a thumbnail of the uploaded file
* Introduced the edittools-upload message, which will be inserted under the
upload form instead of edittools if available
+* (bug 26285) Extensions will be automatically generated on upload if the user
+ specified a filename without extension.
=== Bug fixes in 1.18 ===
* (bug 23119) WikiError class and subclasses are now marked as deprecated
$this->mFinalExtension = trim( $ext[count( $ext ) - 1] );
} else {
$this->mFinalExtension = '';
+
+ # No extension, try guessing one
+ $magic = MimeMagic::singleton();
+ $mime = $magic->guessMimeType( $this->mTempPath );
+ if ( $mime !== 'unknown/unknown' ) {
+ # Get a space separated list of extensions
+ $extList = $magic->getExtensionsForType( $mime );
+ if ( $extList ) {
+ # Set the extension to the canonical extension
+ $this->mFinalExtension = strtok( $extList, ' ' );
+
+ # Fix up the other variables
+ $this->mFilteredName .= ".{$this->mFinalExtension}";
+ $nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName );
+ $ext = array( $this->mFinalExtension );
+ }
+ }
+
}
/* Don't allow users to override the blacklist (check file extension) */