Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Trim whitespace from base64 encoded image data before decoding it (#19977)

Kyle Kelley7ce131aaf8e4
diff --git a/crates/repl/src/outputs/image.rs b/crates/repl/src/outputs/image.rs
index 15881aa9159..648f4aa82c0 100644
--- a/crates/repl/src/outputs/image.rs
+++ b/crates/repl/src/outputs/image.rs
@@ -16,7 +16,7 @@ pub struct ImageView {
impl ImageView {
pub fn from(base64_encoded_data: &str) -> Result<Self> {
- let bytes = BASE64_STANDARD.decode(base64_encoded_data)?;
+ let bytes = BASE64_STANDARD.decode(base64_encoded_data.trim())?;
let format = image::guess_format(&bytes)?;
let mut data = image::load_from_memory_with_format(&bytes, format)?.into_rgba8();