Browse Source

#3401: fix missing file extension if name contains ':'

pull/3410/head
Siegfried Pammer 3 months ago
parent
commit
53522c45f8
  1. 11
      ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs

11
ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs

@ -636,13 +636,9 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler
/// </summary> /// </summary>
static string CleanUpName(string text, bool separateAtDots, bool treatAsFileName, bool treatAsPath) static string CleanUpName(string text, bool separateAtDots, bool treatAsFileName, bool treatAsPath)
{ {
// Remove anything that could be confused with a rooted path.
int pos = text.IndexOf(':');
if (pos > 0)
text = text.Substring(0, pos);
text = text.Trim();
string extension = null; string extension = null;
int currentSegmentLength = 0; int currentSegmentLength = 0;
// Extract extension from the end of the name, if valid
if (treatAsFileName) if (treatAsFileName)
{ {
// Check if input is a file name, i.e., has a valid extension // Check if input is a file name, i.e., has a valid extension
@ -668,6 +664,11 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler
} }
} }
} }
// Remove anything that could be confused with a rooted path.
int pos = text.IndexOf(':');
if (pos > 0)
text = text.Substring(0, pos);
text = text.Trim();
// Remove generics // Remove generics
pos = text.IndexOf('`'); pos = text.IndexOf('`');
if (pos > 0) if (pos > 0)

Loading…
Cancel
Save