diff --git a/packages/config/src/parse.js b/packages/config/src/parse.js index 406c9dac30..813a272c11 100644 --- a/packages/config/src/parse.js +++ b/packages/config/src/parse.js @@ -75,6 +75,6 @@ const validateTomlBlackslashes = function (logs, configString, featureFlags) { // This only applies to " and """ strings, not ' nor ''' // Also, """ strings can use trailing backslashes. const INVALID_TOML_BLACKSLASH = - /= *(?:(?:""".*(? Snapshot 1 + + `{␊ + "accounts": [],␊ + "addons": [],␊ + "branch": "branch",␊ + "buildDir": "packages/config/tests/parse/fixtures/parse_backslash_equal",␊ + "config": {␊ + "build": {␊ + "environment": {},␊ + "ignore": " --test=/"value/" ",␊ + "processing": {␊ + "css": {},␊ + "html": {},␊ + "images": {},␊ + "js": {}␊ + },␊ + "publish": "packages/config/tests/parse/fixtures/parse_backslash_equal",␊ + "publishOrigin": "default",␊ + "services": {}␊ + },␊ + "functions": {␊ + "*": {}␊ + },␊ + "headers": [],␊ + "plugins": [],␊ + "redirects": []␊ + },␊ + "configPath": "packages/config/tests/parse/fixtures/parse_backslash_equal/netlify.toml",␊ + "context": "production",␊ + "env": {␊ + "BRANCH": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "branch"␊ + },␊ + "CACHED_COMMIT_REF": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "HEXADECIMAL_ID"␊ + },␊ + "COMMIT_REF": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "HEXADECIMAL_ID"␊ + },␊ + "CONTEXT": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "production"␊ + },␊ + "GATSBY_TELEMETRY_DISABLED": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "1"␊ + },␊ + "HEAD": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "branch"␊ + },␊ + "LANG": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "en_US.UTF-8"␊ + },␊ + "LANGUAGE": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "en_US:en"␊ + },␊ + "LC_ALL": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "en_US.UTF-8"␊ + },␊ + "NETLIFY_LOCAL": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "true"␊ + },␊ + "NEXT_TELEMETRY_DISABLED": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "1"␊ + },␊ + "PULL_REQUEST": {␊ + "sources": [␊ + "general"␊ + ],␊ + "value": "false"␊ + }␊ + },␊ + "headersPath": "packages/config/tests/parse/fixtures/parse_backslash_equal/_headers",␊ + "redirectsPath": "packages/config/tests/parse/fixtures/parse_backslash_equal/_redirects",␊ + "repositoryRoot": "packages/config/tests/parse/fixtures/parse_backslash_equal",␊ + "siteInfo": {}␊ + }` + ## Redirects - redirects file > Snapshot 1 diff --git a/packages/config/tests/parse/snapshots/tests.js.snap b/packages/config/tests/parse/snapshots/tests.js.snap index 5ff56a960a..9043810678 100644 Binary files a/packages/config/tests/parse/snapshots/tests.js.snap and b/packages/config/tests/parse/snapshots/tests.js.snap differ diff --git a/packages/config/tests/parse/tests.js b/packages/config/tests/parse/tests.js index 0eaa88010c..2f5c2827f5 100644 --- a/packages/config/tests/parse/tests.js +++ b/packages/config/tests/parse/tests.js @@ -70,6 +70,12 @@ test('Configuration file - invalid backslash sequences in multiline single quote }) }) +test('Configuration file - detecting invalid backslash sequences in TOML does not misinterpret equal signs', async (t) => { + await runFixture(t, 'parse_backslash_equal', { + flags: { featureFlags: { netlify_config_toml_backslash: true } }, + }) +}) + test('Redirects - redirects file', async (t) => { await runFixture(t, 'redirects_file') })