Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@stevenjoezhang
Copy link
Member

@stevenjoezhang stevenjoezhang commented Dec 22, 2024

What does it do?

I've noticed that Hexo supports searching for configuration files with different suffixes, such as _config.txt and _config.json. However, this check is very loose, meaning that _config.backup or _config.yml.bak are also considered valid configuration files. This feature can cause confusion and even security issues for users. Therefore, I refactor this feature in the pull request.

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@github-actions
Copy link

How to test

git clone -b config https://github.com/hexojs/hexo.git
cd hexo
npm install
npm test

Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still prefer to automatically choose config.yml or config.json without specifying it. We might wanna make findConfigPath more strict though.

@stevenjoezhang stevenjoezhang changed the title feat(load_config): remove findConfigPath feat(load_config): enforce stricter extension checks Dec 23, 2024
@stevenjoezhang
Copy link
Member Author

@SukkaW I've updated the code, and now the JSON suffix is also supported.

@coveralls
Copy link

coveralls commented Apr 18, 2025

Pull Request Test Coverage Report for Build 14597269367

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.525%

Totals Coverage Status
Change from base Build 14597018384: 0.0%
Covered Lines: 9857
Relevant Lines: 9904

💛 - Coveralls

Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ❤️

@stevenjoezhang stevenjoezhang merged commit 80b6cd1 into master May 3, 2025
24 checks passed
@stevenjoezhang stevenjoezhang deleted the config branch May 3, 2025 03:45
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.

5 participants