Skip to content

Current directory scrubbing regression when path is inside ANSI sequence #1642

@hojmark

Description

@hojmark

Describe the bug

Scrubbing of the current directory no longer works if the path is inside an ANSI sequence.
I have located the regression to first occur in Verify.NUnit 31.5.0 and onwards.

The scrubbing works if the path is not inside an ANSI sequence

Minimal Repro

[Test]
public Task Path_in_ansi_sequence_is_not_scrubbed() {
  var currentDirectory = Directory.GetCurrentDirectory();

  const string boldOn = "\u001b[1m";
  const string reset = "\u001b[0m";

  return Verify( $"Path: {boldOn}{currentDirectory}/myfile.yaml{reset}" );
}

Verify.NUnit 31.4.3:

Path: �[1m{CurrentDirectory}myfile.yaml�[0m

Verify.NUnit 31.5.0 (and later):

Path: �[1m/home/hojmark/git/drift/src/Cli.Tests/bin/Debug/net10.0/myfile.yaml�[0m

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions