Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #227 from tinacms/bug/219-adds-uriencoding-to-branch
Browse files Browse the repository at this point in the history
fix: adds encodeURIComponent() to branch
  • Loading branch information
Enigmatical authored May 27, 2021
2 parents 407922c + ead4cb5 commit aeedb6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/tina-graphql-gateway/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tina-graphql-gateway",
"version": "0.2.11",
"version": "0.2.12",
"main": "dist/index.js",
"files": [
"dist/*"
Expand Down
9 changes: 7 additions & 2 deletions packages/tina-graphql-gateway/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ export class Client {

constructor({ tokenStorage = "MEMORY", ...options }: ServerOptions) {
const _this = this;
/**
* Prevents a CORS-issue when the `branch` has slashes in it.
* https://github.com/tinacms/tina-graphql-gateway/issues/219
*/
const encodedBranch = encodeURIComponent(options.branch);
(this.contentApiUrl =
options.customContentApiUrl ||
`${CONTENT_API_URL}/content/${options.organizationId}/${options.clientId}/github/${options.branch}`),
// `https://content.tinajs.dev/content/${options.organizationId}/${options.clientId}/github/${options.branch}`),
`${CONTENT_API_URL}/content/${options.organizationId}/${options.clientId}/github/${encodedBranch}`),
// `https://content.tinajs.dev/content/${options.organizationId}/${options.clientId}/github/${encodedBranch}`),
(this.clientId = options.clientId);
this.organizationId = options.organizationId;

Expand Down

0 comments on commit aeedb6a

Please sign in to comment.