Skip to content

Commit

Permalink
chore(lib): fix empty binary content check
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Aug 29, 2024
1 parent 228f2d3 commit 8f44400
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "auto_encoder"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
description = "Auto encoding library"
repository = "https://github.com/spider-rs/auto-encoder"
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ pub fn encoding_for_locale(locale: &str) -> Option<&'static encoding_rs::Encodin

/// Checks if the file is a known binary format using its initial bytes.
pub fn is_binary_file(content: &[u8]) -> bool {
if content.is_empty() {
return false;
}

if let Some(&keys) = FIRST_BYTE_MAP.get(&content[0]) {
for &key in keys {
if let Some(&k) = ASSET_NUMBERS.get(key) {
Expand Down

0 comments on commit 8f44400

Please sign in to comment.