Skip to content

Commit 1730e40

Browse files
coderabbitai[bot]CodeRabbit
andauthored
fix: apply CodeRabbit auto-fixes
Fixed 1 file(s) based on 3 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
1 parent c4217f5 commit 1730e40

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎sdks/urbackend-sdk/src/modules/schema.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ export class SchemaModule {
88
* Fetch the schema definition for a collection
99
*/
1010
public async getSchema(collection: string): Promise<CollectionSchema> {
11+
const trimmedCollection = collection.trim();
12+
if (trimmedCollection === '') {
13+
throw new Error('Collection name cannot be empty or whitespace-only');
14+
}
15+
16+
const encodedCollection = encodeURIComponent(trimmedCollection);
1117
const response = await this.client.request<{
1218
message: string;
1319
collection: CollectionSchema;
14-
}>('GET', `/api/schemas/${collection}`);
20+
}>('GET', `/api/schemas/${encodedCollection}`);
1521

1622
return response.collection;
1723
}
18-
}
24+
}

0 commit comments

Comments
 (0)