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

Fix parsing the -Settings object as a path when the path object originates from an expression #915

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve check for file type by trying to cast to PSObject and checkin…
…g its BaseObject property.
  • Loading branch information
bergmeister committed Mar 4, 2018
commit f2eada8e75960f70ac9a6f98e383b0d0f920b497
10 changes: 8 additions & 2 deletions Engine/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,15 @@ internal static SettingsMode FindSettingsMode(object settings, string path, out
{
settingsMode = SettingsMode.Hashtable;
}
else // if the provided object is wrapped in multiple expressions then it might not be resolved yet at this stage -> try using the File type as a last resort and best guess.
else // if the provided argument is wrapped in an expressions then PowerShell resolves it but it will be of type PSObject and we have to operate then on the BaseObject
{
settingsMode = SettingsMode.File;
if (settingsFound is PSObject settingsFoundPSObject)
{
if (settingsFoundPSObject.BaseObject is String)
{
settingsMode = SettingsMode.File;
}
}
}
}
}
Expand Down