rootless-config 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/scriptPatcher.js +19 -0
package/package.json
CHANGED
|
@@ -524,6 +524,25 @@ $root = (Get-Item "$PSScriptRoot\\..\\..").FullName.TrimEnd('\\') + '\
|
|
|
524
524
|
)
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
+
// 4. Null guard + assets fallback for directory-with-no-index case
|
|
528
|
+
// When $root has the directory but no index.html, $filePath becomes $null → Test-Path throws.
|
|
529
|
+
// Fix: check $assetsRoot for the same path, then add null guard on the leaf check.
|
|
530
|
+
const leafCheckLine = ' if (Test-Path $filePath -PathType Leaf) {'
|
|
531
|
+
if (out.includes(leafCheckLine)) {
|
|
532
|
+
out = out.replace(
|
|
533
|
+
leafCheckLine,
|
|
534
|
+
` # rootless: if $root dir had no index, check $assetsRoot dir too
|
|
535
|
+
if ($filePath -eq $null -and $relPath -ne '') {
|
|
536
|
+
$assetsDir = [System.IO.Path]::GetFullPath((Join-Path $assetsRoot $relPath))
|
|
537
|
+
foreach ($idx in @("index.html", "index.htm")) {
|
|
538
|
+
$idxPath = Join-Path $assetsDir $idx
|
|
539
|
+
if (Test-Path $idxPath -PathType Leaf) { $filePath = $idxPath; break }
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if ($filePath -ne $null -and (Test-Path $filePath -PathType Leaf)) {`
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
|
|
527
546
|
return out === content ? null : out
|
|
528
547
|
}
|
|
529
548
|
|