Skip to content

Commit 6b464b8

Browse files
committed
feat: impl supports_stream for svg_io
1 parent 5b4668c commit 6b464b8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sdk/src/asset_handlers/svg_io.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@ impl AssetIO for SvgIO {
160160
&SUPPORTED_TYPES
161161
}
162162

163-
fn supports_stream(&self, _stream: &mut dyn CAIRead) -> Result<bool> {
164-
// TODO: complex
165-
Ok(true)
163+
fn supports_stream(&self, stream: &mut dyn CAIRead) -> Result<bool> {
164+
stream.rewind()?;
165+
166+
let mut bytes = [0u8; 4096];
167+
let len = stream.read(&mut bytes)?;
168+
169+
Ok(bytes[..len].windows(4).any(|pattern| pattern == b"<svg"))
166170
}
167171
}
168172

0 commit comments

Comments
 (0)