Skip to content

Commit f5cef21

Browse files
committed
added validation for sharing
1 parent d5c6f12 commit f5cef21

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plotly/plotly_user_aux/saveplotlyconfig.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function saveplotlyconfig(plotly_domain,plotly_streaming_domain, sharing)
88
error('plotly:saveconfig', ...
99
['Incorrect number of inputs. Please save your configuration ', ...
1010
'as follows: >> saveplotlyconfig(plotly_domain,', ...
11-
'[optional]plotly_streaming_domain),', '[optional]sharing']);
11+
'[optional]plotly_streaming_domain,', '[optional]sharing)']);
1212
end
1313

1414
% if the config file exists, then load it up
@@ -60,7 +60,12 @@ function saveplotlyconfig(plotly_domain,plotly_streaming_domain, sharing)
6060
config.plotly_domain = plotly_domain;
6161
signin(username, api_key, plotly_domain);
6262
config.plotly_streaming_domain = plotly_streaming_domain;
63-
config.sharing = sharing;
63+
if(strcmp(sharing, 'public') | strcmp(sharing, 'private'))
64+
config.sharing = sharing;
65+
else
66+
error(['"%s" is an invalid/un-supported value of sharing.\n', ...
67+
'Please use one of "public" or "private"'], sharing);
68+
end
6469
otherwise %if neither endpoints are specified, no worries!
6570
end
6671

0 commit comments

Comments
 (0)