Skip to content

Commit 0457b63

Browse files
committed
Encode values on 'x-goog-request-params' header.
1 parent 614e23d commit 0457b63

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/firestore/src/remote/rest_connection.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ export abstract class RestConnection implements Connection {
7070
constructor(private readonly databaseInfo: DatabaseInfo) {
7171
this.databaseId = databaseInfo.databaseId;
7272
const proto = databaseInfo.ssl ? 'https' : 'http';
73+
const projectId = encodeURIComponent(this.databaseId.projectId);
74+
const databaseId = encodeURIComponent(this.databaseId.database);
7375
this.baseUrl = proto + '://' + databaseInfo.host;
74-
this.databasePath = `projects/${databaseInfo.databaseId.projectId}/databases/${databaseInfo.databaseId.database}`;
76+
this.databasePath = `projects/${projectId}/databases/${databaseId}`;
7577
this.requestParams =
7678
this.databaseId.database === DEFAULT_DATABASE_NAME
77-
? `project_id=${this.databaseId.projectId}`
78-
: `project_id=${this.databaseId.projectId}&database_id=${this.databaseId.database}`;
79+
? `project_id=${projectId}`
80+
: `project_id=${projectId}&database_id=${databaseId}`;
7981
}
8082

8183
invokeRPC<Req, Resp>(

0 commit comments

Comments
 (0)