Skip to content

Commit f3b78fb

Browse files
committed
update invalid protocal error message
1 parent 573747b commit f3b78fb

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/components/modebar/buttons.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ modeBarButtons.sendChartToCloud = {
9191
console.error('Invalid plotlyServerURL: ' + baseUrl);
9292
return;
9393
}
94-
if (baseUrlObj.protocol !== 'https:' && baseUrlObj.protocol !== 'http:') {
95-
console.error('Invalid protocol for plotlyServerURL: ' + baseUrl);
94+
const supportedProtocols = ['http:', 'https:'];
95+
if (!supportedProtocols.includes(baseUrlObj.protocol)) {
96+
console.error(`Invalid protocol '${baseUrlObj.protocol}' in plotlyServerURL '${baseUrl}'. Must be one of: ${supportedProtocols.join(', ')}`);
9697
return;
9798
}
9899

test/jasmine/tests/config_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ describe('config argument', function() {
569569
.then(function() {
570570
modeBarButtons.sendChartToCloud.click(gd);
571571
expect(document.querySelector('.plotly-cloud-dialog')).toBe(null, 'confirmation dialog should not be shown');
572-
expect(errorSpy).toHaveBeenCalledWith('Invalid protocol for plotlyServerURL: ftp://example.plotly.com');
572+
expect(errorSpy).toHaveBeenCalledWith("Invalid protocol 'ftp:' in plotlyServerURL 'ftp://example.plotly.com'. Must be one of: http:, https:");
573573
})
574574
.then(done, done.fail);
575575
});

0 commit comments

Comments
 (0)