diff --git a/noodles-vcf/CHANGELOG.md b/noodles-vcf/CHANGELOG.md index b316028b8..6d6a6ba93 100644 --- a/noodles-vcf/CHANGELOG.md +++ b/noodles-vcf/CHANGELOG.md @@ -4,8 +4,8 @@ ### Changed - * vcf/variant/record/samples/series/value/array/values: Percent-decode - character and string values. + * vcf/variant/record/samples/series/value: Percent-decode character and + string values. ### Fixed diff --git a/noodles-vcf/src/record/samples/sample.rs b/noodles-vcf/src/record/samples/sample.rs index 69091af41..b468e33c0 100644 --- a/noodles-vcf/src/record/samples/sample.rs +++ b/noodles-vcf/src/record/samples/sample.rs @@ -2,6 +2,7 @@ use std::{io, iter}; use super::Keys; use crate::{ + io::reader::record_buf::value::percent_decode, variant::record::samples::series::{value::Array, Value}, Header, }; @@ -154,7 +155,8 @@ fn parse_float_value(src: &str) -> io::Result> { } fn parse_character_value(src: &str) -> io::Result> { - let mut chars = src.chars(); + let s = percent_decode(src).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; + let mut chars = s.chars(); if let Some(c) = chars.next() { if chars.next().is_none() { @@ -164,13 +166,11 @@ fn parse_character_value(src: &str) -> io::Result> { Err(io::Error::new( io::ErrorKind::InvalidData, - "invalid character value", + "invalid character", )) } fn parse_string_value(src: &str) -> io::Result> { - use crate::io::reader::record_buf::value::percent_decode; - percent_decode(src) .map(Value::String) .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))