Skip to content

Comments

Fix config file lookup when project path contains spaces#154

Merged
BarredEwe merged 3 commits intoBarredEwe:mainfrom
mgacy:153-fix-plugin-paths
Feb 4, 2026
Merged

Fix config file lookup when project path contains spaces#154
BarredEwe merged 3 commits intoBarredEwe:mainfrom
mgacy:153-fix-plugin-paths

Conversation

@mgacy
Copy link
Contributor

@mgacy mgacy commented Feb 3, 2026

Short description 📝

Fixes an issue where the .prefire.yml config file is not found when the project path contains spaces. The plugin passes percent-encoded paths (e.g., My%20Project) which causes the file lookup to fail.

Solution 📦

Decode percent-encoded characters in ConfigPathBuilder.possibleConfigPaths() before constructing the URL:

let decodedPath = path.removingPercentEncoding ?? path
var configURL = URL(filePath: decodedPath)

The root cause is that the plugin uses String(describing: target.directory) which percent-encodes spaces. Alternative fixes were considered:

  1. Change plugin to use target.directory.string — This fixes the encoding but reintroduces deprecation warnings that were removed in Removing swift 5.x support and fixing warnings #101.

  2. Change plugin to use target.directoryURL.path(percentEncoded: false) — This is the ideal solution but directoryURL is only available in swift-tools-version 6.1+, and the package currently targets 6.0.

  3. Decode in the executable (this PR) — A defensive fix that handles percent-encoded input regardless of source, requires no plugin changes, and introduces no warnings. This complements the fixes in Fixed issue where config paths containing spaces #141.

Implementation 👩‍💻👨‍💻

  • Add removingPercentEncoding call in ConfigPathBuilder.possibleConfigPaths() before creating URL from input path

Closes #153

@BarredEwe
Copy link
Owner

Hey! Thanks for the quick fix - this solves the spaces-in-path issue nicely, and the test is a great touch. 👍

Looks good to me. Let’s merge it as-is.

@BarredEwe BarredEwe merged commit c3f9e52 into BarredEwe:main Feb 4, 2026
3 checks passed
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.

Plugin passes percent-encoded paths when project path contains spaces

2 participants