Azure / Azure/azure-rest-api-specs
[BUG] Names containing spaces can result in double encoding and the incorrect ID.
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-02-15-preview/cosmos-db.json#L2235
### API Spec version
2024-02-15-preview
### Describe the bug
Set database name to `database 1` and container name to `container 1`.
When we get the SQL database under the existing Azure Cosmos DB database account using the provided name, the ID is as follows
```json
{
"id": "/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/dbAName/sqlDatabases/database%201"
}
```
Then use the GET operation to obtain the SQL container under the existing Azure Cosmos DB database account.
We will get an incorrect ID. Database name changed to database%25201
```json
{
"id": "/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/dbAName/sqlDatabases/database%25201/containers/container%201",
}
```
### Expected behavior
The name should not allow the use of spaces, or names should not be encoded.
### Actual behavior
Double Encoded Exception
### Reproduction Steps
1. Create a cosmos DB account resource.
2. Create a cosmos DB SQL database resource, database name contains space: e.g. "database 1".
3. Create a cosmos DB SQL Container resource, container name contains space: e.g. "container 1".
4. Get a cosmos DB SQL Container.
### Environment
_No response_
Contributor guide
Research direction
Start with specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-02-15-preview/cosmos-db.json at the referenced line and review the SQL database and container GET operations. Reproduce the request with names containing spaces, then determine whether the specification should reject spaces or prevent double encoding. Done means the returned container ID remains correct and the chosen behavior is represented in the API specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100