Skip to content

Commit

Permalink
Merge pull request #1166 from pmcelhaney/1083-url-encoding
Browse files Browse the repository at this point in the history
work-around for URL encoding in path names (#1083)
  • Loading branch information
pmcelhaney authored Jan 18, 2025
2 parents 3b0bab4 + 74b85ca commit 122f740
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/poor-news-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"counterfact": patch
---

work-around for URL-encoding in path names (#1083)
8 changes: 7 additions & 1 deletion src/typescript-generator/requirement.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ export class Requirement {
}

select(path, data = this.data, basePath = "") {
const parts = path.split("/").map(this.unescapeJsonPointer);
const parts = path
.split("/")
.map(this.unescapeJsonPointer)
// Unescape URL encoded characters (e.g. %20 -> " ")
// Technically we should not be unescaping, but it came up in https://github.com/pmcelhaney/counterfact/issues/1083
// and I can't think of a reason anyone would intentionally put a % in a key name.
.map(unescape);

let result = this;

Expand Down

0 comments on commit 122f740

Please sign in to comment.