mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-03-04 23:07:20 +00:00
id3v2: Use is_ascii_alphabetic() instead of lowercase + uppercase
This commit is contained in:
parent
4f31729ae8
commit
1f3c49e6ac
1 changed files with 1 additions and 6 deletions
|
@ -42,12 +42,7 @@ impl LanguageFrame {
|
||||||
pub fn as_bytes(&self) -> Result<Vec<u8>> {
|
pub fn as_bytes(&self) -> Result<Vec<u8>> {
|
||||||
let mut bytes = vec![self.encoding as u8];
|
let mut bytes = vec![self.encoding as u8];
|
||||||
|
|
||||||
if self.language.len() != 3
|
if self.language.len() != 3 || self.language.iter().any(|c| !c.is_ascii_alphabetic()) {
|
||||||
|| self
|
|
||||||
.language
|
|
||||||
.iter()
|
|
||||||
.any(|c| !c.is_ascii_lowercase() && !c.is_ascii_uppercase())
|
|
||||||
{
|
|
||||||
return Err(ID3v2Error::new(ID3v2ErrorKind::Other(
|
return Err(ID3v2Error::new(ID3v2ErrorKind::Other(
|
||||||
"Invalid frame language found (expected 3 ascii characters)",
|
"Invalid frame language found (expected 3 ascii characters)",
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue