Skip to content

fix(PropertySet): FromFile silently sets Name to $null — .BaseName on a string #14

@HeyItsGilbert

Description

@HeyItsGilbert

Summary

PropertySet.FromFile sets $ps.Name = $ps.FilePath.BaseName. $ps.FilePath is typed [string]; strings have no .BaseName property. PowerShell silently returns $null, so every PropertySet loaded from a file has Name = $null.

File

Gatekeeper/Classes/Property.ps1:139

Root Cause

$ps.FilePath = (Resolve-Path $FilePath).Path   # [string]
$ps.Name     = $ps.FilePath.BaseName            # strings have no .BaseName → $null

Fix

$ps.Name = [System.IO.Path]::GetFileNameWithoutExtension($ps.FilePath)

Notes

  • Good first issue — single-line fix
  • Found by Jordan B., Sage Nakamura, Chip Torres, and Brent Tlackburn

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions