Skip to content

Commit

Permalink
Fix validation in resource id parsing (#704)
Browse files Browse the repository at this point in the history
Co-authored-by: Joel Hendrix <[email protected]>
  • Loading branch information
karataliu and jhendrixMSFT authored Aug 8, 2022
1 parent 711dde1 commit 2fa44cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autorest/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (r Resource) String() string {
// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource?tabs=json#resourceid.
func ParseResourceID(resourceID string) (Resource, error) {

const resourceIDPatternText = `(?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)`
const resourceIDPatternText = `(?i)^/subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)$`
resourceIDPattern := regexp.MustCompile(resourceIDPatternText)
match := resourceIDPattern.FindStringSubmatch(resourceID)

Expand Down

0 comments on commit 2fa44cb

Please sign in to comment.