Skip to content

if diff has space in folderName/fileName in filePath then parsed filename is wrong #387

@future-pirate-king

Description

@future-pirate-king

Step -1: Before filling an issue check out troubleshooting section

Step 0: Describe your environment

  • OS: ubuntu 20.04 LTS
  • diff2html version: 3.4.3
  • Using diff2html directly or using diff2html-ui helper: using both
  • Extra flags: _

Step 1: Describe the problem:

when user creates a folder or file with name some which has space in it then the parsed output of unified diff is giving wrong fileName

Steps to reproduce:

  1. use can use unified diff which has space in folder name or file name and check parsed output

diff example:

diff --git a/notebooks/Untitled Folder/untitled.txt b/notebooks/Untitled Folder/untitled.txt\nnew file mode 100644\nindex 0000000..e69de29\ndiff --git a/notebooks/new.txt b/notebooks/new1.txt\nsimilarity index 83%\nrename from notebooks/new.txt\nrename to notebooks/new1.txt\nindex 0dea293..fe4d7e2 100644\n--- a/notebooks/new.txt\n+++ b/notebooks/new1.txt\n@@ -1,2 +1,2 @@\n Text to test git backend functionality.\n-new li\n\\ No newline at end of file\n+new line\n\\ No newline at end of file\ndiff --git a/notebooks/untitled1.txt b/notebooks/untitled1.txt\nnew file mode 100644\nindex 0000000..3e5126c\n--- /dev/null\n+++ b/notebooks/untitled1.txt\n@@ -0,0 +1 @@\n+new\n\\ No newline at end of file\n

Observed Results:

  • What happened? This could be a description, log output, etc.
    ​​
    addedLines: 0
    blocks: Array []
    checksumAfter: "e69de29"
    checksumBefore: "0000000"
    deletedLines: 0
    isGitDiff: true
    isNew: true
    newFileMode: "100644"
    newName: "Folder/untitled.txt"
    oldName: "notebooks/Untitled Folder/untitled.txt b/notebooks/Untitled"

Expected Results:

  • What did you expect to happen?

newName: "notebooks/Untitled Folder/untitled.txt"
oldName: "notebooks/Untitled Folder/untitled.txt"

Relevant Code:

// TODO(you): code here to reproduce the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions