From f6611843ecda399cca16f8a81da5d01f72070070 Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 26 Mar 2020 13:27:45 -0400 Subject: [PATCH] early return from sendDataToCloud when using blank plotlyServerURL default --- src/plot_api/plot_config.js | 5 +++-- src/plots/plots.js | 5 +++-- test/jasmine/tests/config_test.js | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plot_api/plot_config.js b/src/plot_api/plot_config.js index 9e0fc7ef03f..761b3ffbdbd 100644 --- a/src/plot_api/plot_config.js +++ b/src/plot_api/plot_config.js @@ -34,8 +34,9 @@ var configAttributes = { valType: 'string', dflt: '', description: [ - 'Sets base URL for the \'Edit in Chart Studio\' (aka sendDataToCloud) mode bar button', - 'and the showLink/sendData on-graph link' + 'When set it determines base URL for', + 'the \'Edit in Chart Studio\' (aka sendDataToCloud) mode bar button', + 'and the showLink/sendData on-graph link.' ].join(' ') }, diff --git a/src/plots/plots.js b/src/plots/plots.js index 85d32db040a..5d24930ac58 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -215,9 +215,10 @@ function positionPlayWithData(gd, container) { } plots.sendDataToCloud = function(gd) { - gd.emit('plotly_beforeexport'); - var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL; + if(!baseUrl) return; + + gd.emit('plotly_beforeexport'); var hiddenformDiv = d3.select(gd) .append('div') diff --git a/test/jasmine/tests/config_test.js b/test/jasmine/tests/config_test.js index 9ce98d56264..4d0332dfc12 100644 --- a/test/jasmine/tests/config_test.js +++ b/test/jasmine/tests/config_test.js @@ -509,8 +509,7 @@ describe('config argument', function() { expect(gd._context.plotlyServerURL).toBe(''); Plotly.Plots.sendDataToCloud(gd); - expect(form.action.substring(0, 17)).toBe('http://localhost:'); - expect(form.method).toBe('post'); + expect(form).toBe(undefined); }) .catch(failTest) .then(done);