r43160 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43159‎ | r43160 | r43161 >
Date:22:11, 3 November 2008
Author:raymond
Status:old (Comments)
Tags:
Comment:
Trim the final extension to avoid a confusing warning like
"*.jpg " is not a permitted file type
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -407,7 +407,7 @@
408408 list( $partname, $ext ) = $this->splitExtensions( $filtered );
409409
410410 if( count( $ext ) ) {
411 - $finalExt = $ext[count( $ext ) - 1];
 411+ $finalExt = trim( $ext[count( $ext ) - 1] );
412412 } else {
413413 $finalExt = '';
414414 }

Comments

#Comment by Aaron Schulz (talk | contribs)   22:26, 3 November 2008

Shouldn't splitExtensions() do the trimming to avoid duplicating that step for everything that may use it?

#Comment by Raymond (talk | contribs)   22:36, 3 November 2008

Hmm I think not... Trimming every extension at splitExtensions() is too heavy.

"Image:Example.txt. png .jpg" is a valid filename. I see no reason to trim to "Image:Example.txt.png.jpg" with exception of asthetic.

#Comment by Aaron Schulz (talk | contribs)   22:49, 3 November 2008

It could still trim the last one.

#Comment by Aaron Schulz (talk | contribs)   01:49, 4 November 2008

Meh, not a pressing issue.

Status & tagging log