-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added regex checks for 'Link to Work' and 'Link to Creator Profile' #456
Conversation
@possumbilities please review this PR. Thank you. |
@soustab10 Thanks for working on this! I see you used a new dependency |
@possumbilities vee-validate isn't necessary at all. I was just trying during the development phase to see what works best. I will commit soon with the necessary changes. Thank you. |
@soustab10 It looks like your project isn't passing the checks, can you investigate and verify? |
yes, absolutely. |
@possumbilities the module |
@soustab10 Can't we completely rid of the vee-validate dependency? |
@soustab10 do you mind if we work this out together? |
@Cronus1007 I have removed the vee-validate dependency completely. |
@soustab10 Please revert the changes made in package-lock.json. The workflows are still failing. Please have a look upon them as well. Are you able to run it locally? |
@soustab10 I have resolved the package-lock.json conflict for you. As much as I understood Ig you used |
Thank you @Cronus1007 . What did you change? |
@soustab10 I just used the package-lock.json that is into the |
Okay thanks a lot! Do I need to make any further changes? |
Lets wait for @possumbilities to review the PR as well. |
@Cronus1007 I think there's value in keeping the |
@soustab10 looks like there's still changes requested pending? |
I have made the changes requested via this commit |
@Cronus1007 it's waiting on you to sign off on the review request I think. |
Makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soustab10 Thanks for the contribution 💯
@possumbilities LGTM
Thanks a lot! Hoping to make more contributions! |
Hi! @soustab10 thank you so much for all your work on this, it's greatly appreciated. Apologies for the lengthy delay in response here. I tested this and there's still at least one unresolved issued with the regex. The URL check seems to be capping the validation of the domain extension to 6 characters. As a result valid TLDs will throw an "invalid URL" UX error. For example:
There's a lengthy list of valid domains that are over the 6 character limit in the IANA list. I'd suggest adjusting the regex in the checker to not be bound by the 6character limit on the extension, so the error doesn't throw incorrectly. |
Hi again @soustab10 just letting you know there's still a minor error here that needs resolving before it can be approved. Thanks so much for all your work so far! |
✅ Deploy Preview for creativecommons-chooser ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the requested changes, I think there needs to be more consideration to the UX and user stories:
- I think help text should be a different color (not red, as validation is non-blocking)
- Users of the Chooser interested in print or media may not want the protocol
- (this is an issue in the current design, not just this PR)
- As the validation is non-blocking, it needs to be worded as a suggestion
this.attributionErrorMsg.yearOfCreationError = ''; | ||
} | ||
else { | ||
this.attributionErrorMsg.yearOfCreationError = 'Please enter a valid year'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two digit years are valid, even if imprecise. Also the text is nonblocking.
Please update text to something like: For clarity, please consider a four digit year
@@ -58,7 +62,7 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; | |||
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'; | |||
import { library } from '@fortawesome/fontawesome-svg-core'; | |||
library.add(faInfoCircle); | |||
|
|||
const regexTestString= /[(http(s)?):(www)?a-zA-Z0-9@:%._~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex has a number of problems (including #456 (comment)).
Maybe use The Perfect URL Regular Expression - Perfect URL Regex:
const regexTestString= /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/;
Closing as incomplete work |
Fixes
Description
Tests
This PR can be tested by putting an invalid URL to the mentioned sections. A prompt
Please enter a valid URL
is presented.Screenshots
Leaving the field empty or putting the correct URL gives no error.
Checklist
Update index.md
).main
ormaster
).visible errors.
Developer Certificate of Origin
For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."
Developer Certificate of Origin