Skip to content

Conversation

@kkartunov
Copy link
Contributor

Changes to be done in Work Manager while decommissioning Connect.

Updates:

  • Allow hyphen in url - asset library
  • feat: added show only my projects for project managers
  • PM-973 - invite by email

himaniraghav3 and others added 25 commits March 26, 2025 16:04
…ression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
PM-971 Allow hyphen in url - asset library
fix(PM-974) Allow project managers to view all projects
feat(PM-974): allow PM to view users and delete users from project
fix(PM-974): projects list in challenges tab
* regex for url validation
*/
const urlRegex = /((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2,}){1,3}(#?\/?(?:[a-zA-Z0-9#]+))*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/
const urlRegex = /((https?):\/\/)?(www\.)?[\w-]+(\.[a-z]{2,}){1,3}(#?\/?(?:[a-zA-Z0-9#-]+))*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '#'.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to modify the regular expression to remove the ambiguity that causes exponential backtracking. Specifically, we can replace the ambiguous character class [a-zA-Z0-9#-] with a more precise character class that avoids ambiguity. Additionally, we can simplify the regular expression to ensure it performs efficiently.

  • Replace [a-zA-Z0-9#-]+ with a more specific character class that avoids ambiguity.
  • Ensure the regular expression still matches valid URLs without causing performance issues.
Suggested changeset 1
src/util/validation.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/util/validation.js b/src/util/validation.js
--- a/src/util/validation.js
+++ b/src/util/validation.js
@@ -60,3 +60,3 @@
  */
-const urlRegex = /((https?):\/\/)?(www\.)?[\w-]+(\.[a-z]{2,}){1,3}(#?\/?(?:[a-zA-Z0-9#-]+))*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/
+const urlRegex = /((https?):\/\/)?(www\.)?[\w-]+(\.[a-z]{2,}){1,3}(#?\/?(?:[\w-]+))*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/
 
EOF
@@ -60,3 +60,3 @@
*/
const urlRegex = /((https?):\/\/)?(www\.)?[\w-]+(\.[a-z]{2,}){1,3}(#?\/?(?:[a-zA-Z0-9#-]+))*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/
const urlRegex = /((https?):\/\/)?(www\.)?[\w-]+(\.[a-z]{2,}){1,3}(#?\/?(?:[\w-]+))*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/

Copilot is powered by AI and may make mistakes. Always verify output.
@kkartunov kkartunov requested a review from Copilot April 8, 2025 08:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 21 out of 24 changed files in this pull request and generated 3 comments.

Files not reviewed (3)
  • src/components/Users/Users.module.scss: Language not supported
  • src/containers/ProjectInvitations/ProjectInvitations.module.scss: Language not supported
  • src/containers/Projects/styles.module.scss: Language not supported

} else if (automaticAction === PROJECT_MEMBER_INVITE_STATUS_REFUSED) {
declineInvite()
}
}, [1500])
Copy link

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second parameter for setTimeout should be a number (1500) instead of an array. Please change [1500] to 1500.

Suggested change
}, [1500])
}, 1500)

Copilot uses AI. Check for mistakes.
</div>
{showSelectUserError && (
<div className={styles.row}>
<div className={styles.errorMesssage}>Please select a member.</div>
Copy link

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name 'errorMesssage' appears to be misspelled; consider correcting it to 'errorMessage'.

Copilot uses AI. Check for mistakes.
Comment on lines +100 to +105
<div className={styles.errorMesssage}>Please enter a valid email address.</div>
</div>
)}
{inviteUserError && (
<div className={styles.row}>
<div className={styles.errorMesssage}>{inviteUserError}</div>
Copy link

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name 'errorMesssage' is misspelled; consider correcting it to 'errorMessage'.

Suggested change
<div className={styles.errorMesssage}>Please enter a valid email address.</div>
</div>
)}
{inviteUserError && (
<div className={styles.row}>
<div className={styles.errorMesssage}>{inviteUserError}</div>
<div className={styles.errorMessage}>Please enter a valid email address.</div>
</div>
)}
{inviteUserError && (
<div className={styles.row}>
<div className={styles.errorMessage}>{inviteUserError}</div>

Copilot uses AI. Check for mistakes.
@kkartunov kkartunov closed this Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants