Skip to content

Commit

Permalink
fix: do this instead
Browse files Browse the repository at this point in the history
looks like ampersands are escaped by default, this looks like the move
  • Loading branch information
kanadgupta committed Jun 2, 2023
1 parent d594bfc commit 4b0075b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion __tests__/lib/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('#fetch()', () => {
).then(handleRes);

expect(headers['x-readme-source-url'].shift()).toBe(
'https://github.com/octocat/Hello-World/blob/ffac537e6cbbf934b08745a378932722df287a53/%F0%9F%93%88%20Dashboard%20&%20Metrics/openapi.json'
'https://github.com/octocat/Hello-World/blob/ffac537e6cbbf934b08745a378932722df287a53/%F0%9F%93%88%20Dashboard%20%26%20Metrics%2Fopenapi.json'
);
mock.done();
});
Expand Down
6 changes: 3 additions & 3 deletions src/lib/readmeAPIFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ export default async function readmeAPIFetch(
*/
headers.set(
'x-readme-source-url',
encodeURI(
`${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA}/${filePath}`
)
`${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/blob/${
process.env.GITHUB_SHA
}/${encodeURIComponent(filePath)}`
);
}
}
Expand Down

0 comments on commit 4b0075b

Please sign in to comment.