Skip to content

Validation fails on files with escaped spaces #71

@IKavanagh

Description

@IKavanagh

Description

Our repository includes many files that have spaces in them. GitHub allows spaces in paths in CODEOWNER files but requires them to be escaped with \. A valid CODEOWNER file path like /Testing/Path\ With\ Space.cs shows the correct CODEOWNER in GitHub but our mszostok/codeowners-validator@v0.6.0 GitHub Action fails with the message

==> Executing Valid Syntax Checker
    [err] line 13: Owner 'With\' does not look like an email
    [err] line 13: Owner 'Space.cs' does not look like an email

If there are multiple lines in the CODEOWNER file like

/Testing/Path\ With\ Space.cs    @ian-azyra
/Testing/Path\ With\ More\ Spaces.cs    @ian-azyra

The GitHub Action also states

==> Executing Duplicated Pattern Checker
    [err] Pattern "/Testing/Path\\" is defined 2 times in lines:
        * 13: with owners: [With\ Space.cs @ian-azyra]
        * 14: with owners: [With\ More\ Spaces.cs @ian-azyra]

The following checks also fail

==> Executing File Exist Checker
    [err] line 13: "/Testing/Path\\" does not match any files in repository
    [err] line 14: "/Testing/Path\\" does not match any files in repository

==> Executing Valid Owner Checker
    [err] line 13: Not valid owner definition "With\\"
    [err] line 13: Not valid owner definition "Space.cs"
    [err] line 14: Not valid owner definition "With\\"
    [err] line 14: Not valid owner definition "More\\"
    [err] line 14: Not valid owner definition "Spaces.prg"

Expected result

I would expect file patterns with properly escaped spaces to pass all tests. File paths without escaped spaces should fail.

Actual result

The checks above all fail because they don't recognise the \ character as an escape character.

Steps to reproduce

To reproduce the bug

  1. Create a GitHub Action based on the example in this repository
  2. Create a file path with spaces in a test repository
  3. Add a CODEOWNERS file with a file path that has spaces properly escaped
  4. Run the GitHub Action and it should fail
  5. The code owners displayed on GitHub accept the escaped file

Troubleshooting

For the moment, I have used /Testing/Path*.cs but this isn't granular enough for our repository.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions