Skip to content

Commit 59764f3

Browse files
authored
escape path (#6)
1 parent 8efb982 commit 59764f3

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

__tests__/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test('wait 500 ms', async () => {
1818

1919
// replace the externalId, public key and private key with your own
2020
test('sqluser', async () => {
21-
const externalId = "{\"project_id\":\"163469\",\"cluster_id\":\"2939253\",\"branch_id\":\"branch-t393ywvw3qhswh7getjzwv\",\"branch_name\":\"syh-test2\"}"
21+
const externalId = "{\"project_id\":\"163469\",\"cluster_id\":\"3478958\",\"branch_id\":\"bran-pbc3jwxonzhcrmbhqxicopyojq\",\"branch_name\":\"hello/syh\"}"
2222
const sqlUser = await sqluser( externalId,
2323
msg => core.info(msg),
2424
"",

dist/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sqluser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ export async function sqluser(
5353

5454
const client = new DigestFetch(publicKey, privateKey)
5555

56+
const escapeBranchName = encodeURIComponent(branchName)
57+
5658
// get sql user
57-
const sqlUserUrl = `${host}/api/internal/projects/${projectID}/clusters/${clusterID}/branches/${branchName}/users`
59+
const sqlUserUrl = `${host}/api/internal/projects/${projectID}/clusters/${clusterID}/branches/${escapeBranchName}/users`
5860
log(`request url to get sql user: ${sqlUserUrl}`)
5961
const resp = await client.fetch(sqlUserUrl, {method: 'POST'})
6062
const data = await resp.json()

0 commit comments

Comments
 (0)