Skip to content

Commit 04661d8

Browse files
authored
fix: remove cleanTemporarily and date-gated API path cleaning (#607)
- Remove cleanTemporarily() and its usage in cleanurl() - remove related tests as well
1 parent cf3eeae commit 04661d8

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/utils.mjs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,6 @@ function cleanCode(str) {
278278
return str;
279279
}
280280

281-
function cleanTemporarily(str) {
282-
return [
283-
[/\/api\/fetchmasterdata.+/i, '/api/fetchmasterdata'],
284-
[/\/api\/masterdatafetch.+/i, '/api/masterdatafetch'],
285-
[/\/api\/mdm.+/i, '/api/mdm'],
286-
[/\/api\/employer.+/i, '/api/employer'],
287-
[/\/api\/perfios.+/i, '/api/perfios'],
288-
[/\/kyccallback.+/i, '/kyccallback'],
289-
].reduce((acc, [regex, replacement]) => acc.replace(regex, replacement), str);
290-
}
291-
292281
export function cleanurl(url) {
293282
// if URL does not parse, return it as is
294283
try {
@@ -300,9 +289,6 @@ export function cleanurl(url) {
300289
u.hash = '';
301290
u.pathname = cleanPath(u.pathname, ['jwt', 'uuid', 'email']);
302291
u.pathname = cleanCode(u.pathname);
303-
if (new Date() < new Date(2026, 2, 1)) {
304-
u.pathname = cleanTemporarily(u.pathname);
305-
}
306292
return u.toString().replace(/@/g, '');
307293
} catch (e) {
308294
return cleanCode(cleanPath(url, ['jwt', 'uuid', 'email']));

test/utils.test.mjs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,24 +152,6 @@ Pellentesque viverra id magna vel varius. Lorem ipsum dolor sit amet, consectetu
152152
// Combined: UUID with query strings and fragments
153153
assert.equal(cleanurl('https://example.com/user/550e8400-e29b-41d4-a716-446655440000?foo=bar#section'), 'https://example.com/user/%3Cuuid%3E');
154154

155-
// cleanTemporarily function - API paths cleaned until 2026-03-01
156-
assert.equal(cleanurl('https://api.example.com/api/fetchmasterdata?id=12345&token=abc'), 'https://api.example.com/api/fetchmasterdata');
157-
assert.equal(cleanurl('https://api.example.com/api/masterdatafetch/users/all'), 'https://api.example.com/api/masterdatafetch');
158-
assert.equal(cleanurl('https://api.example.com/api/mdm/endpoint/data'), 'https://api.example.com/api/mdm');
159-
assert.equal(cleanurl('https://api.example.com/api/employer/12345/details'), 'https://api.example.com/api/employer');
160-
161-
// perfios and kyccallback endpoints (often have UUIDs)
162-
assert.equal(cleanurl('https://api.example.com/api/perfios.550e8400-e29b-41d4-a716-446655440000'), 'https://api.example.com/api/perfios');
163-
assert.equal(cleanurl('https://api.example.com/api/perfios.123E4567-E89B-12D3-A456-426614174000/data'), 'https://api.example.com/api/perfios');
164-
assert.equal(cleanurl('https://api.example.com/kyccallback.550e8400-e29b-41d4-a716-446655440000'), 'https://api.example.com/kyccallback');
165-
assert.equal(cleanurl('https://api.example.com/kyccallback.550e8400e29b41d4a716446655440000/status'), 'https://api.example.com/kyccallback');
166-
assert.equal(cleanurl('https://api.example.com/kyccallback'), 'https://api.example.com/kyccallback');
167-
168-
assert.equal(cleanurl('https://api.example.com/API/FetchMasterData?foo=bar'), 'https://api.example.com/API/FetchMasterData');
169-
assert.equal(cleanurl('https://api.example.com/api/MasterDataFetch/something'), 'https://api.example.com/api/masterdatafetch');
170-
assert.equal(cleanurl('https://api.example.com/API/Perfios/123e4567-e89b-12d3-a456-426614174000'), 'https://api.example.com/api/perfios');
171-
assert.equal(cleanurl('https://api.example.com/KYCCallback/data'), 'https://api.example.com/kyccallback');
172-
173155
// AEM Asset identifiers - should be preserved
174156
// Test 1: AEM Assets with URN identifier (base path)
175157
assert.equal(cleanurl('https://assets.adobe.com/adobe/assets/urn:aaid:aem:12345678-1234-1234-1234-123456789abc'), 'https://assets.adobe.com/adobe/assets/urn:aaid:aem:12345678-1234-1234-1234-123456789abc');

0 commit comments

Comments
 (0)