Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to add a space before ";" (semi-colon)? #55

Closed
lbrachet opened this issue Apr 19, 2023 · 2 comments
Closed

Need to add a space before ";" (semi-colon)? #55

lbrachet opened this issue Apr 19, 2023 · 2 comments

Comments

@lbrachet
Copy link

lbrachet commented Apr 19, 2023

Hello,

I'm trying to add a DMARC TXT and I always have "unescaped ;".

TEST 1

Input:

_dmarc:
  - type: TXT
    value: 'v=DMARC1; p=quarantine'

Result:

unescaped ; in "v=DMARC1; p=quarantine"

TEST 2

Input:

_dmarc:
  - type: TXT
    value: "v=DMARC1; p=quarantine"

Result:

unescaped ; in "v=DMARC1; p=quarantine"

TEST 3

Input:

_dmarc:
  - type: TXT
    value: "v=DMARC1\; p=quarantine"

Result:

yaml.scanner.ScannerError: while scanning a double-quoted scalar found unknown escape character ';'

TEST 4

Input:

_dmarc:
  - type: TXT
    value: v=DMARC1; p=quarantine

Result:

unescaped ; in "v=DMARC1; p=quarantine"

TEST 5

So I tried with an escaping "" before the ";":

Input:

_dmarc:
  - type: TXT
    value: v=DMARC1\; p=quarantine

Result:

['v=DMARC1\; p=quarantine']> (config)

TEST 6

But there is the "" which is not great. ;)

Input:

_dmarc:
  - type: TXT
    value: v=DMARC1\; p=quarantine

Result:

['v=DMARC1\; p=quarantine']> (config)

What am I doing wrong?

Thanks.

@ross
Copy link
Contributor

ross commented Apr 19, 2023

_dmarc:
  - type: TXT
    value: v=DMARC1\; p=quarantine

^ is the correct/simplest way to denote a record with an escaped ; in it. After pushing that up to Route53 I can query the result and get the desired/expected value back:

(env) coho:octodns-route53 ross$ dig +short TXT _dmarc.exxampled.com. @ns-2027.awsdns-61.co.uk.
"v=DMARC1; p=quarantine"

If you for some reason want to quote the string in YAML you'll need to use \\ so that YAML parsing will put a single \ in the resulting value. \ is the YAML string escape character so it takes two of them to get a single literal \.

_dmarc:
  - type: TXT
    value: "v=DMARC1\\; p=quarantine"

@lbrachet
Copy link
Author

Thanks Ross, it's good for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants