Skip to content

Commit

Permalink
Change sanitized url path string to match UXR request
Browse files Browse the repository at this point in the history
  • Loading branch information
mjac0bs committed Dec 3, 2024
1 parent d57c38d commit c2e805f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
17 changes: 7 additions & 10 deletions packages/manager/src/hooks/usePendo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import { transformUrl } from './usePendo';

const ID_URLS = [
{
expectedTransform: 'https://cloud.linode.com/nodebalancers/XXXX',
expectedTransform: 'https://cloud.linode.com/nodebalancers/*',
position: 'end',
url: 'https://cloud.linode.com/nodebalancers/123',
},
{
expectedTransform:
'https://cloud.linode.com/nodebalancers/XXXX/configurations',
'https://cloud.linode.com/nodebalancers/*/configurations',
position: 'middle',
url: 'https://cloud.linode.com/nodebalancers/123/configurations',
},
{
expectedTransform:
'https://cloud.linode.com/nodebalancers/XXXX/configurations/XXXX',
'https://cloud.linode.com/nodebalancers/*/configurations/*',
position: 'multiple',
url: 'https://cloud.linode.com/nodebalancers/123/configurations/456',
},
Expand All @@ -37,23 +37,20 @@ const USERNAME_URLS = [

const OBJ_URLS = [
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX',
expectedTransform: 'http://cloud.linode.com/object-storage/buckets/*/*',
path: 'us-west/abc123',
},
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX/ssl',
expectedTransform: 'http://cloud.linode.com/object-storage/buckets/*/*/ssl',
path: 'us-west/abc123/ssl',
},
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX',
expectedTransform: 'http://cloud.linode.com/object-storage/buckets/*/*',
path: 'us-west/123abc',
},
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX/access',
'http://cloud.linode.com/object-storage/buckets/*/*/access',
path: 'us-west/123abc/access',
},
];
Expand Down
8 changes: 4 additions & 4 deletions packages/manager/src/hooks/usePendo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export const transformUrl = (url: string) => {
const oauthPathMatchingRegex = /(#access_token).*/;
let transformedUrl = url;

// Replace any ids with XXXX and keep the rest of the URL intact
transformedUrl = url.replace(idMatchingRegex, '/XXXX');
// Replace any ids with * and keep the rest of the URL intact
transformedUrl = url.replace(idMatchingRegex, `/*`);

// Replace the region and bucket names with XXXX and keep the rest of the URL intact.
// Replace the region and bucket names with * and keep the rest of the URL intact.
// Object storage file navigation is truncated via the 'clear search' transform.
transformedUrl = transformedUrl.replace(
bucketPathMatchingRegex,
'buckets/XXXX/XXXX'
'buckets/*/*'
);

// Remove everything after access_token
Expand Down

0 comments on commit c2e805f

Please sign in to comment.