diff options
Diffstat (limited to 'subplotlib/src/file.rs')
-rw-r--r-- | subplotlib/src/file.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/subplotlib/src/file.rs b/subplotlib/src/file.rs index 84f3495..c1c9afe 100644 --- a/subplotlib/src/file.rs +++ b/subplotlib/src/file.rs @@ -7,7 +7,8 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; -use base64::decode; +use base64::prelude::{Engine as _, BASE64_STANDARD}; + /// An embedded data file. /// /// Embedded data files have names and content. The subplot template will generate @@ -82,11 +83,16 @@ impl SubplotDataFile { /// /// This will panic if the passed in strings are not correctly base64 encoded. pub fn new(name: &str, data: &str) -> Self { - let name = decode(name).expect("Subplot generated bad base64?"); + let name = BASE64_STANDARD + .decode(name) + .expect("Subplot generated bad base64?"); let name = String::from_utf8_lossy(&name); let name: PathBuf = name.as_ref().into(); let name = name.into(); - let data = decode(data).expect("Subplot generated bad base64?").into(); + let data = BASE64_STANDARD + .decode(data) + .expect("Subplot generated bad base64?") + .into(); Self { name, data } } |