Skip to content

GetDefaultLogFolderPath() fails due to bad Regex #309

Description

@helpimnotdrowning

When attempting to import the module, it will throw an error like

at GetDefaultLogFolderPath, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 226 # <<<
at LogSettings, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 186
at Parse, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 357
at Load, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 35
at ConfigurationDocument, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 29
at Get-ConfigurationDocument<Process>, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 678
at <ScriptBlock>, /home/helpimnotdrowning/.local/share/powershell/Modules/PSHTML/0.8.2/PSHTML.psm1: line 9888
<...>
Get-ConfigurationDocument: Cannot bind argument to parameter 'Path' because it is null.

The method looks like

    [String]GetDefaultLogFolderPath(){
        if($global:PSVersionTable.os -match '^Linux.*'){
            #Linux
            $p = "/tmp/pshtml/"
        }elseif($global:PSVersionTable.OS -match '^Darwin.*'){
            #Macos
            $p = $env:TMPDIR
        }
        Else{
            #Windows
            $p = Join-Path $Env:Temp -ChildPath "pshtml" # <<< line 226
        }
        return $p
    }

My $global:PSVersionTable.os is Debian GNU/Linux 12 (bookworm), which does not match ^Linux.*. $env:temp is not a set env. var on my installation (and seems to be a Windows thing)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions