aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go')
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
index e87ac63..956c899 100644
--- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
+++ b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go
@@ -27,9 +27,6 @@ func Unquote(s string) (t string, err error) {
if quote != '"' {
return "", ErrSyntax
}
- if contains(s, '\n') {
- return "", ErrSyntax
- }
// Is it trivial? Avoid allocation.
if !contains(s, '\\') && !contains(s, quote) && !contains(s, '$') {
@@ -49,7 +46,7 @@ func Unquote(s string) (t string, err error) {
for len(s) > 0 {
// If we're starting a '${}' then let it through un-unquoted.
// Specifically: we don't unquote any characters within the `${}`
- // section, except for escaped quotes, which we handle specifically.
+ // section, except for escaped backslashes, which we handle specifically.
if s[0] == '$' && len(s) > 1 && s[1] == '{' {
buf = append(buf, '$', '{')
s = s[2:]
@@ -64,10 +61,12 @@ func Unquote(s string) (t string, err error) {
s = s[size:]
- // We special case escaped double quotes in interpolations, converting
- // them to straight double quotes.
+ // We special case escaped backslashes in interpolations, converting
+ // them to their unescaped equivalents.
if r == '\\' {
- if q, _ := utf8.DecodeRuneInString(s); q == '"' {
+ q, _ := utf8.DecodeRuneInString(s)
+ switch q {
+ case '\\':
continue
}
}