[BUG]ResourceIdentifier allows whitespace?!
See original GitHub issueLibrary name and version
Azure.Core 1.32.0
Describe the bug
I’m using ResourceIdentifier.TryParse()
to validate user input of a resource ID. Just noticed that this accepts resource IDs with whitespace in them. I believe this is a bug since those are not valid IDs?!
Samples which are not being caught by the validation:
"/subscriptions/7ddfffd7-9b32-40df-b352-828cbd55d6f4/resourceGroups/group-with spaces/providers/Microsoft.Network/publicIpAddresses/public-ip-nerd"
"/subscriptions/ 7ddfffd7-9b32-40df-b352-828cbd55d6f4/resourceGroups/group/providers/Microsoft.Network/publicIpAddresses/public-ip-nerd"
"/subscriptions/7ddfffd7-9b32-40df-b352-828cbd55d6f4/resourceGroups/groupwith\nnewline/providers/Microsoft.Network/publicIpAddresses/public-ip-nerd"
Was added in https://github.com/Azure/azure-sdk-for-net/pull/32039 by @m-nash
Expected behavior
Resource IDs with spaces anywhere in them should not pass validation.
Actual behavior
See above
Reproduction Steps
ResourceIdentifier.TryParse("/subscriptions/7ddfffd7-9b32-40df-b352-828cbd55d6f4/resourceGroups/group-with spaces/providers/Microsoft.Network/publicIpAddresses/public-ip-nerd", out var _);
Environment
dotnet 7
Issue Analytics
- State:
- Created 2 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Regular expression to allow spaces between words
A string that leads and / or trails with spaces, " Hello World ". A string that contains multiple spaces in between words,...
Read more >reStructuredText Markup Specification - Docutils - SourceForge
Indented literal blocks are indicated by indentation relative to the surrounding text (leading whitespace on each line). The minimum indentation will be removed ......
Read more >MathML Fundamentals
In MathML, as in XML, "whitespace" means simple spaces, tabs, newlines, or carriage returns, i.e., characters with hexadecimal Unicode codes U+0020, U+0009, U+ ......
Read more >How whitespace is handled by HTML, CSS, and in the DOM
Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line...
Read more >Has whitespace in identifiers ever been idiomatic? [closed]
Whitespace is a language that seeks to redress the balance. Any non whitespace characters are ignored; only spaces, tabs and newlines are ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am reporting a real case here 😉
I meant service return an arm-id like this, but anyway this is definitely a bug, @live1206 will follow up with this issue.