PrateekKumarSingh / AzViz

⚡ ☁ Azure Visualizer aka 'AzViz' : A #powershell module to automatically generate Azure resource topology diagrams by just typing a PowerShell cmdlet and passing the name of one or more Azure Resource groups
MIT License
587 stars 146 forks source link

Escape spaces in OutputFilePath before passing to Export-PSGraph #53

Closed moiaune closed 3 years ago

moiaune commented 3 years ago

This PR fixes an issue where an error is thrown when you use Export-AzViz with a filepath that contains spaces and the -Show argument is passed.

This error occurs because Export-PSGraph, when -Show is $true, will use Invoke-Expression to try to open the file in the systems default application. Invoke-Expression does not support spaces.

moiaune commented 3 years ago

This was clearly not tested enough by me. PSGraph includes the backticks in filename and cannot find folders since its treating the backticks literally. Essentially the problem is with PSGraph not supporting spaces in filepaths.

There is a PR open in the PSGraph repository (https://github.com/KevinMarquette/PSGraph/pull/102) for replacing Invoke-Expression with Invoke-Item which does support spaces in filepaths. Better wait for PSGraph to update.