nu-engine: deserialize_struct: fix missing conversion from string to column path (#3048)

This commit is contained in:
Saeed Rasooli 2021-02-12 23:59:38 +03:30 committed by GitHub
parent abd2632977
commit 617341f8d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ use nu_protocol::{
hir::CapturedBlock, CallInfo, ColumnPath, Primitive, RangeInclusion, ShellTypeName, hir::CapturedBlock, CallInfo, ColumnPath, Primitive, RangeInclusion, ShellTypeName,
UntaggedValue, Value, UntaggedValue, Value,
}; };
use nu_source::Span;
use nu_source::{HasSpan, Spanned, SpannedItem, Tagged, TaggedItem}; use nu_source::{HasSpan, Spanned, SpannedItem, Tagged, TaggedItem};
use nu_value_ext::ValueExt; use nu_value_ext::ValueExt;
use serde::de; use serde::de;
@ -401,6 +402,13 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> {
value: UntaggedValue::Primitive(Primitive::ColumnPath(path)), value: UntaggedValue::Primitive(Primitive::ColumnPath(path)),
.. ..
} => path, } => path,
Value {
value: UntaggedValue::Primitive(Primitive::String(path)),
..
} => {
let s = path.spanned(Span::unknown());
ColumnPath::build(&s)
}
other => { other => {
return Err(ShellError::type_error( return Err(ShellError::type_error(
"column path", "column path",