Skip to content

Commit ab69d83

Browse files
committed
fix auth issues
1 parent 445d36b commit ab69d83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/contentstack-utilities/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const validatePath = (input: string) => {
5656
export const escapeRegExp = (str: string) => str?.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
5757

5858
// To remove the relative path
59-
export const sanitizePath = (str: string) => str.replace(/^(\.\.(\/|\\|$))+/, '');
59+
export const sanitizePath = (str: string) => str?.replace(/^(\.\.(\/|\\|$))+/, '');
6060

6161
// To validate the UIDs of assets
6262
export const validateUids = (uid) => /^[a-zA-Z0-9]+$/.test(uid);
@@ -65,6 +65,6 @@ export const validateUids = (uid) => /^[a-zA-Z0-9]+$/.test(uid);
6565
export const validateFileName = (fileName) => /^[a-zA-Z0-9-_\.]+$/.test(fileName);
6666

6767
// Validate Regex
68-
export const replaceNonAlphanumericWithEmpty = input => input.replace(/[^a-zA-Z0-9]/g, '');
68+
export const replaceNonAlphanumericWithEmpty = input => input?.replace(/[^a-zA-Z0-9]/g, '');
6969

7070
export const isValidURL = url => /^(https?:\/\/)?(www\.)?[a-zA-Z0-9-]+(\.[a-zA-Z]{2,})([\/\w .-]*)*\/?$/.test(url);

0 commit comments

Comments
 (0)