diff --git a/.travis.yml b/.travis.yml index eb16d3bf..8fce79f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - "pip install -r requirements.txt" - "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/base.txt" - "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/test.txt" - - "pip uninstall -y xblock-problem-builder && python setup.py sdist && pip install dist/xblock-problem-builder-2.0.2.tar.gz" + - "pip uninstall -y xblock-problem-builder && python setup.py sdist && pip install dist/xblock-problem-builder-2.0.3.tar.gz" - "pip install -r test_requirements.txt" - "mkdir var" script: diff --git a/problem_builder/public/js/dashboard.js b/problem_builder/public/js/dashboard.js index fdd4ef99..bb7e879a 100644 --- a/problem_builder/public/js/dashboard.js +++ b/problem_builder/public/js/dashboard.js @@ -8,6 +8,18 @@ function PBDashboardBlock(runtime, element, initData) { var generateDataUriFromImageURL = function(imgURL) { // Given the URL to an image, IF the image has already been cached by the browser, // returns a data: URI with the contents of the image (image will be converted to PNG) + + // Expand relative urls and urls without an explicit protocol into absolute urls + var a = document.createElement('a'); + a.href = imgURL; + imgURL = a.href; + + // If the image is from another domain, just return its URL. We can't + // create a data URL from cross-domain images: + // https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-todataurl + if (a.origin !== window.location.origin) + return imgURL; + var img = new Image(); img.src = imgURL; if (!img.complete) diff --git a/setup.py b/setup.py index 908e163a..d649c384 100644 --- a/setup.py +++ b/setup.py @@ -75,7 +75,7 @@ def package_data(pkg, root_list): setup( name='xblock-problem-builder', - version='2.0.2', + version='2.0.3', description='XBlock - Problem Builder', packages=['problem_builder', 'problem_builder.v1'], install_requires=[