Skip to content

Fix #82: Add image path validation #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

irusukan
Copy link
Contributor

@irusukan irusukan commented May 6, 2025

Overview

Fixes #82: Adds validation to skip empty image path inputs and reject spaces/dots-only inputs, preventing Hugo rendering errors.

Issue Details

Problems:

  • Pressing Enter without input for the image path causes a site rendering error (render: failed to render pages).
  • Similarly, inputs like " " or "." trigger the same error.

Reproduction Steps:

  1. Launch blowfish-tools (v1.10.0).
  2. Select "onfigure images".
  3. Select any menu.
  4. Enter "", " ", or "." and press Enter.
  5. Run Hugo server to observe rendering error.

Cause:

Empty inputs cause normalizePath() to return ".", written to languages.en.toml as [params] logo = ".", triggering Hugo rendering errors.
Spaces or dots-only inputs (e.g., " ", ". ") also cause errors.

Changes

  • Added empty input check to normalizePath() to skip configuration.
  • Added enquirer validation (/^[\s.]+$/) to reject spaces/dots-only inputs with error message.

Testing

  • Tested with "", " ", "." , " . . . ", confirming empty inputs are skipped and invalid inputs rejected.
  • Verified valid inputs (e.g., /img/logo.png) work correctly.
  • Ran Hugo server to ensure no errors.

Thanks for reviewing!

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.

Not specifying logo breaks configuration
1 participant