Skip to content

Inconsistent behavior with escaped single quotes & brace expansion #480

@Oasiris

Description

@Oasiris

Environment

  • OS Version
    1. MacOS Ventura 13.4.1 (Apple Silicon)
    2. Windows 10
  • Node.js Version: 22.7.0
  • fast-glob: 3.3.2

Actual behavior

On MacOS and Windows, escaping single quotes will cause some globs that otherwise fail (return no results) to succeed, but cause other globs that would otherwise succeed to fail.

Expected behavior

  • Either the tests with escaped single quotes should return results, or the tests with unescaped single quotes should return results.

Steps to reproduce


Code sample

For this directory structure:

# Setup
mkdir fourth
touch "fourth/file'sA.md" 
touch "fourth/file'sB.md"
mkdir "fifth's"
touch "fifth's/fileA.md" 
touch "fifth's/fileB.md" 

The following test is picky about single quotes being escaped:

require("fast-glob").sync("fourth/file's{A,B}.md")
// => []
require("fast-glob").sync("fourth/file\\'s{A,B}.md")
// => ["fourth/file'sA.md", "fourth/file'sB.md"]

The following test is picky about single quotes being UN-escaped:

require("fast-glob").sync("fifth's/file*.md")
// => ["fifth's/fileA.md", "fifth's/fileB.md"]
require("fast-glob").sync("fifth\\'s/file*.md")
// => []

The following test fails regardless of whether the quote is escaped or not:

require("fast-glob").sync("fifth's/file{A,B}.md")
// => []
require("fast-glob").sync("fifth\\'s/file{A,B}.md")
// => []

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions