Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NBug] Illegal characters in path. #8571

Closed
richhock opened this issue Oct 24, 2020 · 3 comments · Fixed by #8575
Closed

[NBug] Illegal characters in path. #8571

richhock opened this issue Oct 24, 2020 · 3 comments · Fixed by #8575
Assignees

Comments

@richhock
Copy link

⚠️ The sections below must be filled in and this text must be removed or the issue will be closed.

Current behaviour

Expected behaviour

Steps to reproduce

Error Details

System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.IsPathRooted(String path)
   at GitCommands.FullPathResolver.Resolve(String path)
   at GitUI.Editor.FileViewer.SetVisibilityDiffContextMenu(Boolean visibleTextFile, String fileName)
   at GitUI.Editor.FileViewer.ResetForText(String fileName)
   at GitUI.Editor.FileViewer.<>c__DisplayClass105_0.<ViewTextAsync>b__0()
   at GitUI.Editor.FileViewer.ShowOrDeferAsync(Int64 contentLength, Func`1 showFunc)
   at GitUI.Editor.FileViewer.<ViewTextAsync>d__105.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at GitUI.CommandsDialogs.RevisionDiffControl.<ShowSelectedFileDiffAsync>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at GitUI.CommandsDialogs.RevisionDiffControl.<<DiffFiles_SelectedIndexChanged>b__36_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at GitUI.ThreadHelper.<>c__DisplayClass13_0.<<FileAndForget>b__0>d.MoveNext()

Additional information

Created a github wiki page with the title
00-abc-"d"-e-f-g,h-(ij)-k&l-m;-n@o

Fetched updates from github, clicked on the newly-fetched commit, and clicked on the Diff tab in Git Extensions when this failure occurred.

Environment

  • Git Extensions 3.4.3.9999
  • Build d4b0f48
  • Git 2.20.1.windows.1 (recommended: 2.25.1 or later)
  • Microsoft Windows NT 10.0.19041.0
  • .NET Framework 4.8.4250.0
  • DPI 96dpi (no scaling)
@duplicates-detector-bot
Copy link

Potential duplicates:

  • #6981
  • #6982
  • #7528
  • #7592
  • #7601
  • #7608
  • #7643
  • #7722
  • #7799
  • #7860
  • #7862
  • #7936
  • #7977
  • #8005
  • #8052
  • #8090
  • #8107
  • #8151
  • #8202
  • #8259
  • #8282
  • #8364
  • #8383
  • #8570

@gerhardol
Copy link
Member

FullPathResolver.Resolve() should check for legal characters and return null if the path have illegal chars.
(It currently throws if called with whitespace too, should also be null.)
All callers with FileExists(Resolve()) will return false, as expected (like in this case as well as FormCommit, RevDiff etc)

There are some other usages that will get a null pointer instead and will very likely throw a different exception, but in the context of the caller instead.

(An alternative is to to add an option to return null only when option set to do so and change call sites explicitly.)

@gerhardol gerhardol self-assigned this Oct 25, 2020
@ghost ghost added the 🚧 status: in progress Issues which have associated PRs label Oct 25, 2020
@gerhardol
Copy link
Member

Please try #8575
You will not be able to do much with commits named like this as Git can for instance check out the commits, but GE will not crash at load and you can view files.

@ghost ghost removed the 🚧 status: in progress Issues which have associated PRs label Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants