Tpt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/71991


Change subject: Add support for x3d files
......................................................................

Add support for x3d files

Add X3D MIME types detection and fix the block of the upload because of the
filtering of the <head> tag.

Change-Id: I39712097b505ec1192eb5ab578d23c73b62a7160
---
M includes/DefaultSettings.php
M includes/mime.types
M includes/upload/UploadBase.php
3 files changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/91/71991/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 10f2885..162608b 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1087,6 +1087,7 @@
        'http://www.lysator.liu.se/~alla/dia/:diagram' => 
'application/x-dia-diagram',
        'http://www.w3.org/1999/xhtml:html' => 'text/html', // 
application/xhtml+xml?
        'html' => 'text/html', // application/xhtml+xml?
+       'X3D' => 'model/x3d+xml',
 );
 
 /**
diff --git a/includes/mime.types b/includes/mime.types
index a89d229..2ae51bc 100644
--- a/includes/mime.types
+++ b/includes/mime.types
@@ -104,6 +104,9 @@
 model/iges igs iges
 model/mesh msh mesh silo
 model/vrml wrl vrml
+model/x3d+xml x3d
+model/x3d+vrml x3dv
+model/x3d+binary x3db
 text/calendar ics ifb
 text/css css
 text/html html htm
diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 36e4252..6e1e7e5 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -1038,7 +1038,6 @@
                $tags = array(
                        '<a href',
                        '<body',
-                       '<head',
                        '<html',   #also in safari
                        '<img',
                        '<pre',
@@ -1050,6 +1049,10 @@
                        $tags[] = '<title';
                }
 
+               if ( $extension !== 'x3d' && $mime !== 'model/x3d+xml' ) {
+                       $tags[] = '<head';
+               }
+
                foreach ( $tags as $tag ) {
                        if ( false !== strpos( $chunk, $tag ) ) {
                                wfDebug( __METHOD__ . ": found something that 
may make it be mistaken for html: $tag\n" );

-- 
To view, visit https://gerrit.wikimedia.org/r/71991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I39712097b505ec1192eb5ab578d23c73b62a7160
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tpt <thoma...@hotmail.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to