Skip to content

Commit

Permalink
updated to base64 (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
Billy-Sheppard committed Feb 17, 2023
1 parent 930fb55 commit 200e376
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"

[dependencies]
anyhow = "1"
base64 = "0.13"
base64 = "0.21"
derive_builder = "0.12"
directories = { version = "4.0", optional = true }
log = "0.4"
Expand Down
14 changes: 11 additions & 3 deletions src/browser/tab/mod.rs
Expand Up @@ -26,6 +26,8 @@ use crate::protocol::cdp::{

use Runtime::AddBinding;

use base64::Engine;

use Input::DispatchKeyEvent;

use Page::{AddScriptToEvaluateOnNewDocument, Navigate, SetInterceptFileChooserDialog};
Expand Down Expand Up @@ -1049,7 +1051,9 @@ impl Tab {
capture_beyond_viewport: None,
})?
.data;
base64::decode(data).map_err(Into::into)
base64::prelude::BASE64_STANDARD
.decode(data)
.map_err(Into::into)
}

pub fn print_to_pdf(&self, options: Option<PrintToPdfOptions>) -> Result<Vec<u8>> {
Expand All @@ -1076,15 +1080,19 @@ impl Tab {
transfer_mode,
})?
.data;
base64::decode(data).map_err(Into::into)
base64::prelude::BASE64_STANDARD
.decode(data)
.map_err(Into::into)
} else {
let data = self
.call_method(Page::PrintToPDF {
..Default::default()
})?
.data;

base64::decode(data).map_err(Into::into)
base64::prelude::BASE64_STANDARD
.decode(data)
.map_err(Into::into)
}
}

Expand Down

0 comments on commit 200e376

Please sign in to comment.