[fix] fix build failure from package vulnerability - #149
Conversation
packageid:Tmds.DBus.Protocol Added Warning As Error: Package 'Tmds.DBus.Protocol' 0.21.2 has a known high severity vulnerability, GHSA-xrw6-gwf8-vvr9
|
@thando-ndlovu Thanks for the contribution! Unfortunately this PR needs a few updates: First, this PR conflates two things: the exception fix you experienced, and the build failure. I did not want to fix the build failure by pinning that specific dependency; so I fixed that separately in #150. You can revert that part of this PR and make this PR just about the exception fix. Second, I would encourage you to check out a new branch from master for all pull requests. That will make it easier for you to submit parallel PRs, allow maintainers to update the PR without affecting your master branch, and more easily update your master branch once this is merged without having to force-push. Third, the fix for the exception is incomplete. This now fixes it for a trailing separator, but breaks it for cases where there is no trailing separator. A more robust fix would be to use string outDirFullName = outDir.FullName;
foreach (var jFile in FolderInputFiles.Where(static x => x.Directory is not null))
{
// ! null checked above
string jPath = jFile.Directory!.FullName;
string relativePath = Path.GetRelativePath(dir.FullName, jPath);
string jOutPath = Path.Combine(outDirFullName, relativePath);
...
}If you are not available or interested in making this update, just let me know and I can fix it. I would have done it myself; I just don't want to force-push your master branch. Thanks! |
Package 'Tmds.DBus.Protocol' explicitly added as build fails from transient package usage. `Warning As Error: Package 'Tmds.DBus.Protocol' 0.21.2 has a known high severity vulnerability, GHSA-xrw6-gwf8-vvr9
File JavaToCSharpGui\ViewModels\MainWindowViewModel.cs
Line187 has been changed from
int subStartIndex = dir.FullName.Length;toint subStartIndex = dir.FullName.Length - 1;'startIndex cannot be larger than length of string. (Parameter 'startIndex')'thrown on line193,string jOutPath = $"{outDirFullName}{jPath[subStartIndex..]}";when sub directories are not present or .java files are directly under chosen directoryPrevious result takes
maindir/subdir_one/file_one.javaand createsmaindir/maindir_csharp_outputsubdir_one/file_one.java&maindir/maindir_csharp_output/subdir_one/file_one.javacurrent result takes
maindir/subdir_one/file_one.javaand cretes onlymaindir/maindir_csharp_output/subdir_one/file_one.java