1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Relax validation of git urls

This commit is contained in:
Nick O'Leary 2018-02-01 10:42:04 +00:00
parent 68a3d71ee6
commit 4117961236
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 5 additions and 3 deletions

View File

@ -1288,7 +1288,8 @@ RED.projects.settings = (function() {
var validateForm = function() { var validateForm = function() {
var validName = /^[a-zA-Z0-9\-_]+$/.test(remoteNameInput.val()); var validName = /^[a-zA-Z0-9\-_]+$/.test(remoteNameInput.val());
var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\.git)?(?:\/?|\#[\d\w\.\-_]+?)$/.test(remoteURLInput.val()); // var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\.git)?(?:\/?|\#[\d\w\.\-_]+?)$/.test(remoteURLInput.val());
var validRepo = !/\s/.test(remoteURLInput.val());
saveButton.attr('disabled',(!validName || !validRepo)) saveButton.attr('disabled',(!validName || !validRepo))
remoteNameInput.toggleClass('input-error',remoteNameInputChanged&&!validName); remoteNameInput.toggleClass('input-error',remoteNameInputChanged&&!validName);
if (popover) { if (popover) {

View File

@ -681,7 +681,8 @@ RED.projects = (function() {
} else if (projectType === 'clone') { } else if (projectType === 'clone') {
var repo = projectRepoInput.val(); var repo = projectRepoInput.val();
var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\/?|\#[\d\w\.\-_]+?)$/.test(repo); // var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\/?|\#[\d\w\.\-_]+?)$/.test(repo);
var validRepo = !/\s/.test(repo);
if (!validRepo) { if (!validRepo) {
if (projectRepoChanged) { if (projectRepoChanged) {
projectRepoInput.addClass("input-error"); projectRepoInput.addClass("input-error");
@ -690,7 +691,7 @@ RED.projects = (function() {
} else { } else {
projectRepoInput.removeClass("input-error"); projectRepoInput.removeClass("input-error");
} }
if (/^(?:ssh|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?/.test(repo)) { if (/^(?:ssh|[\S]+?@[\S]+?):(?:\/\/)?/.test(repo)) {
$(".projects-dialog-screen-create-row-creds").hide(); $(".projects-dialog-screen-create-row-creds").hide();
$(".projects-dialog-screen-create-row-sshkey").show(); $(".projects-dialog-screen-create-row-sshkey").show();
// if ( !getSelectedSSHKey(projectRepoSSHKeySelect) ) { // if ( !getSelectedSSHKey(projectRepoSSHKeySelect) ) {