Commit fe0e8254 by Omar Khan

Merge pull request #106 from open-craft/omar/edx-release/report-download

Fix dashboard report image download (edx-release hotfix)
parents a4e1e429 85f9a263
...@@ -9,7 +9,7 @@ install: ...@@ -9,7 +9,7 @@ install:
- "pip install -r requirements.txt" - "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/base.txt"
- "pip install -r $VIRTUAL_ENV/src/xblock-sdk/requirements/test.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" - "pip install -r test_requirements.txt"
- "mkdir var" - "mkdir var"
script: script:
......
...@@ -8,6 +8,18 @@ function PBDashboardBlock(runtime, element, initData) { ...@@ -8,6 +8,18 @@ function PBDashboardBlock(runtime, element, initData) {
var generateDataUriFromImageURL = function(imgURL) { var generateDataUriFromImageURL = function(imgURL) {
// Given the URL to an image, IF the image has already been cached by the browser, // 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) // 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(); var img = new Image();
img.src = imgURL; img.src = imgURL;
if (!img.complete) if (!img.complete)
......
...@@ -75,7 +75,7 @@ BLOCKS = [ ...@@ -75,7 +75,7 @@ BLOCKS = [
setup( setup(
name='xblock-problem-builder', name='xblock-problem-builder',
version='2.0.2', version='2.0.3',
description='XBlock - Problem Builder', description='XBlock - Problem Builder',
packages=['problem_builder', 'problem_builder.v1'], packages=['problem_builder', 'problem_builder.v1'],
install_requires=[ install_requires=[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment