milestone patch v3.0.1 - a3
3. Infinite Categorization Nesting
File: src/MyBookTools.psm1
Function: Invoke-MyBookCategorize
Issue: Running categorization multiple times causes files to nest infinitely (e.g., moving Projects/file.txt into Projects/Projects/file.txt).
Root Cause: The logic computes relative paths from the root without checking if the file is already seated within a valid category destination.
Resolution:
Implement a guard clause to bypass files that reside within any computed destination directory.
foreach ($file in $files) {
# Skip if the file is already seated in a destination category directory
$alreadyCategorized = $false
foreach ($dest in $destinations.Values) {
if ($file.FullName.StartsWith($dest, [System.StringComparison]::InvariantCultureIgnoreCase)) {
$alreadyCategorized = $true
break
}
}
if ($alreadyCategorized) { continue }
$targetCategory = $null
# ... [rest of existing matching logic] ...
milestone patch v3.0.1 - a3
3. Infinite Categorization Nesting
File:
src/MyBookTools.psm1Function:
Invoke-MyBookCategorizeIssue: Running categorization multiple times causes files to nest infinitely (e.g., moving
Projects/file.txtintoProjects/Projects/file.txt).Root Cause: The logic computes relative paths from the root without checking if the file is already seated within a valid category destination.
Resolution:
Implement a guard clause to bypass files that reside within any computed destination directory.