mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-12 19:25:37 +00:00
review feed back on URI
This commit is contained in:
parent
6d7d76a3f1
commit
3b1bcac5b3
@ -30,7 +30,7 @@ func (e *uriEncoder) PrintLeadingContent(writer io.Writer, content string) error
|
|||||||
func (e *uriEncoder) Encode(writer io.Writer, originalNode *yaml.Node) error {
|
func (e *uriEncoder) Encode(writer io.Writer, originalNode *yaml.Node) error {
|
||||||
node := unwrapDoc(originalNode)
|
node := unwrapDoc(originalNode)
|
||||||
if guessTagFromCustomType(node) != "!!str" {
|
if guessTagFromCustomType(node) != "!!str" {
|
||||||
return fmt.Errorf("cannot encode %v as url, can only operate on strings. Please first pipe through another encoding operator to convert the value to a string", node.Tag)
|
return fmt.Errorf("cannot encode %v as URI, can only operate on strings. Please first pipe through another encoding operator to convert the value to a string", node.Tag)
|
||||||
}
|
}
|
||||||
_, err := writer.Write([]byte(url.QueryEscape(originalNode.Value)))
|
_, err := writer.Write([]byte(url.QueryEscape(originalNode.Value)))
|
||||||
return err
|
return err
|
||||||
|
@ -78,8 +78,8 @@ var participleYqRules = []*participleYqRule{
|
|||||||
{"Base64d", `@base64d`, decodeOp(Base64InputFormat), 0},
|
{"Base64d", `@base64d`, decodeOp(Base64InputFormat), 0},
|
||||||
{"Base64", `@base64`, encodeWithIndent(Base64OutputFormat, 0), 0},
|
{"Base64", `@base64`, encodeWithIndent(Base64OutputFormat, 0), 0},
|
||||||
|
|
||||||
{"Urld", `@urid`, decodeOp(UriInputFormat), 0},
|
{"Urid", `@urid`, decodeOp(UriInputFormat), 0},
|
||||||
{"Url", `@uri`, encodeWithIndent(UriOutputFormat, 0), 0},
|
{"Uri", `@uri`, encodeWithIndent(UriOutputFormat, 0), 0},
|
||||||
|
|
||||||
{"LoadXML", `load_?xml|xml_?load`, loadOp(NewXMLDecoder(ConfiguredXMLPreferences), false), 0},
|
{"LoadXML", `load_?xml|xml_?load`, loadOp(NewXMLDecoder(ConfiguredXMLPreferences), false), 0},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user