Skip to content

Commit

Permalink
Update URL validation function - is_uri
Browse files Browse the repository at this point in the history
  • Loading branch information
mah0001 committed Aug 1, 2024
1 parent b2cf4c6 commit cfa6b15
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions application/views/metadata_editor/index_vuetify_main_app.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,13 @@

VeeValidate.extend('is_uri', {
validate(value){
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
return !!pattern.test(value);

try {
return Boolean(new URL(value));
}
catch(e){
return false;
}
},
getMessage: (field, params, data) => {
return data.message;
Expand Down

0 comments on commit cfa6b15

Please sign in to comment.