Skip to content

Commit

Permalink
Improved folder sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Apr 30, 2024
1 parent 88282fb commit 24424b0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Source/v2/Meadow.CLI/Commands/Current/App/AppTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,14 @@ internal static string SanitizeMeadowFilename(string fileName)
{
if (!folder.StartsWith(Path.DirectorySeparatorChar))
{
folder = $"{Path.DirectorySeparatorChar}{folder}";
}
if (!folder.Contains(MeadowRootFolder))
{
folder = $"{Path.DirectorySeparatorChar}{MeadowRootFolder}{folder}";
if (!folder.StartsWith($"{MeadowRootFolder}"))
{
folder = $"{Path.DirectorySeparatorChar}{MeadowRootFolder}{Path.DirectorySeparatorChar}{folder}";
}
else
{
folder = $"{Path.DirectorySeparatorChar}{folder}";
}
}
}

Expand Down

0 comments on commit 24424b0

Please sign in to comment.