Closed exoego closed 9 months ago
https://aws.permissions.cloud/iam/s3
If one searches the term that is the prefix for the service name of the page, error "aws.permissions.cloud.js:716 Uncaught TypeError: Cannot read properties of undefined (reading 'action')" is raised. See 716th line: https://github.com/iann0036/aws.permissions.cloud/blob/e3e97441ed197acb976c4e2ed04e1c1b440a9624/assets/js/aws.permissions.cloud.js#L708-L717
sdk_map['sdk_method_iam_mappings'][results[i]][0] could be undefined because the first element is shifted here: https://github.com/iann0036/aws.permissions.cloud/blob/e3e97441ed197acb976c4e2ed04e1c1b440a9624/assets/js/aws.permissions.cloud.js#L877-L882
sdk_map['sdk_method_iam_mappings'][results[i]][0]
undefined
Array#shift() mutates the original array so it affects on usage of the array in other places.
Array#shift()
This PR avoid the mutation to fix the TypeError.
Searching s3 on /iam/s3 and /api/s3 raise errors:
s3
/iam/s3
/api/s3
Searching dynamodb on /iam/s3 and /api/s3 is fine:
dynamodb
Searching dynamodb on /iam/dynamodb and /api/dynamodb raise errors:
/iam/dynamodb
/api/dynamodb
Searching s3 on /iam/dynamodb and /api/dynamodb is fine:
https://aws.permissions.cloud/iam/s3
If one searches the term that is the prefix for the service name of the page, error "aws.permissions.cloud.js:716 Uncaught TypeError: Cannot read properties of undefined (reading 'action')" is raised. See 716th line: https://github.com/iann0036/aws.permissions.cloud/blob/e3e97441ed197acb976c4e2ed04e1c1b440a9624/assets/js/aws.permissions.cloud.js#L708-L717
sdk_map['sdk_method_iam_mappings'][results[i]][0]
could beundefined
because the first element is shifted here: https://github.com/iann0036/aws.permissions.cloud/blob/e3e97441ed197acb976c4e2ed04e1c1b440a9624/assets/js/aws.permissions.cloud.js#L877-L882Array#shift()
mutates the original array so it affects on usage of the array in other places.This PR avoid the mutation to fix the TypeError.
Errors
Searching
s3
on/iam/s3
and/api/s3
raise errors:Searching
dynamodb
on/iam/s3
and/api/s3
is fine:Searching
dynamodb
on/iam/dynamodb
and/api/dynamodb
raise errors:Searching
s3
on/iam/dynamodb
and/api/dynamodb
is fine: