Skip to content

Fix CreateByRelativePathCoreAsync file-tail detection for StorableType.Folder#106

Open
Arlodotexe wants to merge 1 commit intomainfrom
fix/createbyrelativepath-file-tail-detection
Open

Fix CreateByRelativePathCoreAsync file-tail detection for StorableType.Folder#106
Arlodotexe wants to merge 1 commit intomainfrom
fix/createbyrelativepath-file-tail-detection

Conversation

@Arlodotexe
Copy link
Owner

Summary

Fixes CreateByRelativePathCoreAsync file-tail detection for StorableType.Folder to prevent treating file paths like path/to/file.txt as folder paths during folder creation.

Root Cause

The folder creation loop in CreateByRelativePathCoreAsync iterated over ALL path segments without checking if the last segment represented a file (indicated by dots suggesting extensions). This caused paths like assets/images/hero.png to create a folder named hero.png.

Fix

Added file-tail detection using existing LooksLikeFileTail helper:

  • Checks if last segment looks like a file (has dots, no trailing slash)
  • Reduces effective loop length to exclude file-like tail from folder creation
  • Preserves existing behavior for paths with trailing slashes or no file-like segments

Validation

  • Blog Generator Materialization: Fix validated during PostPageFolder refactor (Nov 9, 2025)
  • Runtime Behavior: Template asset copying now succeeds (previously stalled creating hero.png folder)
  • Root Cause Confirmed: Log analysis showed malformed paths like /C:\/Users/.../images/hero.png before fix

…e.Folder

Excludes file-like path segments from folder creation loop to prevent treating 'file.txt' as folder name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant