From ad1c673e3634eb0c03b451da7647c362e6d91858 Mon Sep 17 00:00:00 2001
From: johnshaughnessy <johnfshaughnessy@gmail.com>
Date: Tue, 7 Aug 2018 13:32:06 -0700
Subject: [PATCH] Check content type using includes, not equality.

---
 src/assets/stylesheets/create-object-dialog.scss | 2 +-
 src/components/gltf-model-plus.js                | 2 +-
 src/components/image-plus.js                     | 2 +-
 src/components/media-loader.js                   | 4 ++--
 src/utils/media-utils.js                         | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/assets/stylesheets/create-object-dialog.scss b/src/assets/stylesheets/create-object-dialog.scss
index a22f0c605..9500fa41e 100644
--- a/src/assets/stylesheets/create-object-dialog.scss
+++ b/src/assets/stylesheets/create-object-dialog.scss
@@ -65,7 +65,7 @@
   font-size: 1.2em;
   align-self: center;
   overflow: hidden;
-  text-overflow: ellipsis; 
+  text-overflow: ellipsis;
 }
 
 :local(.hide-file-input) {
diff --git a/src/components/gltf-model-plus.js b/src/components/gltf-model-plus.js
index 8b1d02b7d..fc16ac058 100644
--- a/src/components/gltf-model-plus.js
+++ b/src/components/gltf-model-plus.js
@@ -200,7 +200,7 @@ function cachedLoadGLTF(src, basePath, contentType, preferredTechnique, onProgre
       try {
         let gltfUrl = src;
         let onLoad = resolve;
-        if (contentType === "model/gltf+zip" || contentType === "application/x-zip-compressed") {
+        if (contentType.includes("model/gltf+zip") || contentType.includes("application/x-zip-compressed")) {
           const fileMap = await getFilesFromSketchfabZip(src);
           gltfUrl = fileMap["scene.gtlf"];
           onLoad = model => {
diff --git a/src/components/image-plus.js b/src/components/image-plus.js
index 5110cebba..067d9bad2 100644
--- a/src/components/image-plus.js
+++ b/src/components/image-plus.js
@@ -191,7 +191,7 @@ AFRAME.registerComponent("image-plus", {
         cacheItem = { count: 1 };
         if (url === "error") {
           texture = errorTexture;
-        } else if (contentType === "image/gif") {
+        } else if (contentType.includes("image/gif")) {
           texture = await this.loadGIF(url);
         } else if (contentType.startsWith("image/")) {
           texture = await this.loadImage(url);
diff --git a/src/components/media-loader.js b/src/components/media-loader.js
index d71801161..a38430972 100644
--- a/src/components/media-loader.js
+++ b/src/components/media-loader.js
@@ -92,8 +92,8 @@ AFRAME.registerComponent("media-loader", {
         this.el.setAttribute("image-plus", { src: blobUrl || raw, contentType });
         this.el.setAttribute("position-at-box-shape-border", { target: ".delete-button", dirs: ["forward", "back"] });
       } else if (
-        contentType.indexOf("application/octet-stream") !== -1 ||
-        contentType.indexOf("x-zip-compressed") !== -1 ||
+        contentType.includes("application/octet-stream") ||
+        contentType.includes("x-zip-compressed") ||
         contentType.startsWith("model/gltf") ||
         url.endsWith(".gltf") ||
         url.endsWith(".glb")
diff --git a/src/utils/media-utils.js b/src/utils/media-utils.js
index 770b69819..ab2189cd4 100644
--- a/src/utils/media-utils.js
+++ b/src/utils/media-utils.js
@@ -41,7 +41,7 @@ export const addMedia = (src, resize = false) => {
   entity.setAttribute("media-loader", { resize, src: typeof src === "string" ? src : "" });
   scene.appendChild(entity);
 
-  if (typeof src === "object") {
+  if (src instanceof File) {
     upload(src)
       .then(response => {
         const src = response.raw;
-- 
GitLab