Skip to content

Commit 59fae2d

Browse files
mchantandrei-ng
authored andcommitted
limit datatypes for b_64
1 parent 3c0976f commit 59fae2d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plotly/src/plot.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,15 @@ impl Plot {
425425
width: usize,
426426
height: usize,
427427
scale: f64,
428-
) -> String {
428+
) -> Result<String, Error> {
429+
match format{
430+
ImageFormat::JPEG => {},
431+
ImageFormat::PNG => {},
432+
ImageFormat::WEBP => {},
433+
_ => {
434+
return Err(Error::new("format can only be JPEG, PNG, or WEBP"));
435+
},
436+
}
429437
let kaleido = plotly_kaleido::Kaleido::new();
430438
let output = kaleido
431439
.to_b64(

0 commit comments

Comments
 (0)