Skip to content

Commit

Permalink
fix(util-endpoints): revert handling case when resourcePath contains …
Browse files Browse the repository at this point in the history
…both delimiters

This reverts commit 855f1fa.
It'll be added, if needed, in a separate PR.
  • Loading branch information
trivikr committed Aug 13, 2024
1 parent 855f1fa commit 3937a6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 0 additions & 10 deletions packages/util-endpoints/src/lib/aws/parseArn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@ describe(parseArn.name, () => {
resourceId: ["myTopic"],
},
],
[
"arn:aws:s3:us-west-2:123456789012:my:folder/my:file",
{
partition: "aws",
service: "s3",
region: "us-west-2",
accountId: "123456789012",
resourceId: ["my", "folder", "my", "file"],
},
],
];

it.each(VALID_TEST_CASES)("returns for valid arn %s", (input: string, outout: EndpointARN) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/util-endpoints/src/lib/aws/parseArn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const parseArn = (value: string): EndpointARN | null => {

if (arn !== "arn" || partition === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "") return null;

const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
const resourceId = resourcePath[0].includes(RESOURCE_DELIMITER)
? resourcePath[0].split(RESOURCE_DELIMITER)
: resourcePath;

return {
partition,
Expand Down

0 comments on commit 3937a6a

Please sign in to comment.