http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90646

Revision: 90646
Author:   neilk
Date:     2011-06-23 06:08:31 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
ensure that periods do not appear in our API calls, but are encoded.

Modified Paths:
--------------
    trunk/extensions/UploadWizard/resources/mw.Api.js
    trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
    trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js
    trunk/extensions/UploadWizard/resources/mw.canvas.js
    trunk/extensions/UploadWizard/resources/mw.fileApi.js

Added Paths:
-----------
    trunk/extensions/UploadWizard/resources/foo.txt

Added: trunk/extensions/UploadWizard/resources/foo.txt
===================================================================
--- trunk/extensions/UploadWizard/resources/foo.txt                             
(rev 0)
+++ trunk/extensions/UploadWizard/resources/foo.txt     2011-06-23 06:08:31 UTC 
(rev 90646)
@@ -0,0 +1,4 @@
+fdlkjsdfljslfjlsdjlfjsd
+sdfsdfsf
+fdsfsdfsd
+


Property changes on: trunk/extensions/UploadWizard/resources/foo.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/UploadWizard/resources/mw.Api.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.Api.js   2011-06-23 04:57:14 UTC 
(rev 90645)
+++ trunk/extensions/UploadWizard/resources/mw.Api.js   2011-06-23 06:08:31 UTC 
(rev 90646)
@@ -122,7 +122,11 @@
                ajax: function( parameters, ajaxOptions ) {
                        parameters = $j.extend( {}, this.defaults.parameters, 
parameters );
                        ajaxOptions = $j.extend( {}, this.defaults.ajax, 
ajaxOptions );
-                       ajaxOptions.data = parameters;
+
+                       // Some deployed MediaWiki >= 1.17 forbid periods in 
URLs, due to an IE XSS bug
+                       // So let's escape them here. See bug #28235
+                       // This works because jQuery accepts data as a query 
string or as an Object
+                       ajaxOptions.data = $j.param( parameters ).replace( 
/\./g, '%2E' );
                
                        ajaxOptions.error = function( xhr, textStatus, 
exception ) {
                                ajaxOptions.err( 'http', { xhr: xhr, 
textStatus: textStatus, exception: exception } );

Modified: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.UploadWizard.js  2011-06-23 
04:57:14 UTC (rev 90645)
+++ trunk/extensions/UploadWizard/resources/mw.UploadWizard.js  2011-06-23 
06:08:31 UTC (rev 90646)
@@ -327,22 +327,24 @@
         * @param {Object} (as returned by jpegmeta)
         */
        extractMetadataFromJpegMeta: function( meta ) {
-               if ( !mw.isDefined( this.imageinfo ) ) {
-                       this.imageinfo = {};
-               }
-               if ( !mw.isDefined( this.imageinfo.metadata ) ) {
-                       this.imageinfo.metadata = {};
-               }
-               if ( meta.tiff && meta.tiff.Orientation ) {
-                       this.imageinfo.metadata.orientation = 
meta.tiff.Orientation.value; 
-               }
-               if ( meta.general ) {
-                       if ( meta.general.pixelHeight ) {
-                               this.imageinfo.height = 
meta.general.pixelHeight.value;
+               if ( mw.isDefined( meta ) && meta !== null && typeof meta === 
'object' ) { 
+                       if ( !mw.isDefined( this.imageinfo ) ) {
+                               this.imageinfo = {};
                        }
-                       if ( meta.general.pixelWidth ) {
-                               this.imageinfo.width = 
meta.general.pixelWidth.value;
+                       if ( !mw.isDefined( this.imageinfo.metadata ) ) {
+                               this.imageinfo.metadata = {};
                        }
+                       if ( meta.tiff && meta.tiff.Orientation ) {
+                               this.imageinfo.metadata.orientation = 
meta.tiff.Orientation.value; 
+                       }
+                       if ( meta.general ) {
+                               if ( meta.general.pixelHeight ) {
+                                       this.imageinfo.height = 
meta.general.pixelHeight.value;
+                               }
+                               if ( meta.general.pixelWidth ) {
+                                       this.imageinfo.width = 
meta.general.pixelWidth.value;
+                               }
+                       }
                }
        },
 

Modified: 
trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js   
2011-06-23 04:57:14 UTC (rev 90645)
+++ trunk/extensions/UploadWizard/resources/mw.UploadWizardUploadInterface.js   
2011-06-23 06:08:31 UTC (rev 90646)
@@ -274,10 +274,17 @@
                                });
                }
 
-               this.clearStatus();
+               // TODO refactor -- the metadata is not extracted yet at 
fileChanged event
+               var statusItems = [];
+               if ( this.upload.imageinfo && this.upload.imageinfo.width && 
this.upload.imageinfo.height ) {
+                       statusItems.push( this.upload.imageinfo.width + 
'\u00d7' + this.upload.imageinfo.height );
+               }
                if ( this.upload.file ) {
-                       this.setStatusString( mw.units.bytes( 
this.upload.file.size ) );        
+                       statusItems.push( mw.units.bytes( this.upload.file.size 
) );
                }
+               
+               this.clearStatus();
+               this.setStatusString( statusItems.join( ' \u00b7 ' ) );
        },
 
        /**

Modified: trunk/extensions/UploadWizard/resources/mw.canvas.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.canvas.js        2011-06-23 
04:57:14 UTC (rev 90645)
+++ trunk/extensions/UploadWizard/resources/mw.canvas.js        2011-06-23 
06:08:31 UTC (rev 90646)
@@ -5,7 +5,7 @@
                 * @return boolean
                 */
                isAvailable: function() {
-                       return !! ( 
document.createElement('canvas')['getContext'] );
+                       return false; //return !! ( 
document.createElement('canvas')['getContext'] );
                }
 
        }

Modified: trunk/extensions/UploadWizard/resources/mw.fileApi.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.fileApi.js       2011-06-23 
04:57:14 UTC (rev 90645)
+++ trunk/extensions/UploadWizard/resources/mw.fileApi.js       2011-06-23 
06:08:31 UTC (rev 90646)
@@ -2,13 +2,14 @@
 
 ( function( $, mw ) { 
 
-       /**
-        * Is the FileAPI available with sufficient functionality?
-        */
        mw.fileApi = { 
 
+               /**
+                * Is the FileAPI available with sufficient functionality?
+                * @return boolean
+                */
                isAvailable: function() {
-                       return typeof window.FileReader !== 'undefined';
+                       return false; // return typeof window.FileReader !== 
'undefined';
                },
 
                /**


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to