aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-27 15:04:15 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-27 15:04:15 -0400
commit2daee90fae5c93082434bdf34fc046e0ea871800 (patch)
treeea95e568f1b554d0748a5524eab30a93cb563fe5 /src
parentccc10aab91f2b8d01a93277796ff0fbf603ff631 (diff)
Added cors proxy to ImageBox
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/ImageBox.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index 4aee3f68c..2115024a1 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -30,7 +30,7 @@ import FaceRectangles from './FaceRectangles';
import { faEye } from '@fortawesome/free-regular-svg-icons';
var requestImageSize = require('../../util/request-image-size');
var path = require('path');
-const { Howl, Howler } = require('howler');
+const { Howl } = require('howler');
library.add(faImage, faEye, faPaintBrush);
@@ -252,8 +252,12 @@ export class ImageBox extends DocComponent<FieldViewProps, ImageDocument>(ImageD
choosePath(url: URL) {
const lower = url.href.toLowerCase();
- if (url.protocol === "data" || url.href.indexOf(window.location.origin) === -1 || !(lower.endsWith(".png") || lower.endsWith(".jpg") || lower.endsWith(".jpeg"))) {
+ if (url.protocol === "data") {
return url.href;
+ } else if (url.href.indexOf(window.location.origin) === -1) {
+ return Utils.CorsProxy(url.href);
+ } else if (!(lower.endsWith(".png") || lower.endsWith(".jpg") || lower.endsWith(".jpeg"))) {
+ return url.href;//Why is this here
}
let ext = path.extname(url.href);
const suffix = this.props.renderDepth < 1 ? "_o" : this._curSuffix;