r50390 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50389‎ | r50390 | r50391 >
Date:21:17, 9 May 2009
Author:j
Status:deferred
Tags:
Comment:
make sure file extension is ogg/ogv before calling fogg.upload
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js
@@ -111,7 +111,7 @@
112112
113113 //hide any errors warnings and video select:
114114 $j( '#wgfogg_waring_ogg_upload,#wgfogg_waring_bad_extension,#fogg-video-file' ).hide();
115 - },
 115+ },
116116 select_fogg:function(){
117117 var _this = this;
118118 if( _this.fogg.selectVideo() ) {
@@ -175,6 +175,20 @@
176176 if( ! _this.api_url )
177177 return js_error( 'Error: can\'t autodetect mode without api url' );
178178
 179+ //extension should already be ogg but since its user editable,
 180+ //check again
 181+ //we are transcoding so we know it will be an ogg
 182+ //(should not be done for passthrough mode)
 183+ var sf = _this.formData['wpDestFile'];
 184+ var ext = '';
 185+ if( sf.lastIndexOf('.') != -1){
 186+ ext = sf.substring( sf.lastIndexOf('.') ).toLowerCase();
 187+ }
 188+ if ( ext != '.ogg' && ext != '.ogv' ) {
 189+ var extreg = new RegExp(ext + '$', 'i');
 190+ _this.formData['wpDestFile'] = sf.replace(extreg, '.ogg');
 191+ }
 192+
179193 //add chunk response hook to build the resultURL when uploading chunks
180194
181195 //build the api url:

Status & tagging log