Changeset View
Changeset View
Standalone View
Standalone View
assets/src/bundles/save/index.js
Show First 20 Lines • Show All 358 Lines • ▼ Show 20 Lines | export function validateSaveOriginUrl(input) { | ||||
try { | try { | ||||
originUrl = new URL(input.value.trim()); | originUrl = new URL(input.value.trim()); | ||||
} catch (TypeError) { | } catch (TypeError) { | ||||
validUrl = false; | validUrl = false; | ||||
} | } | ||||
if (validUrl) { | if (validUrl) { | ||||
const allowedProtocols = ['http:', 'https:', 'svn:', 'git:']; | const allowedProtocols = ['http:', 'https:', 'svn:', 'git:', 'rsync:', 'pserver:', 'ssh:']; | ||||
validUrl = ( | validUrl = ( | ||||
allowedProtocols.find(protocol => protocol === originUrl.protocol) !== undefined | allowedProtocols.find(protocol => protocol === originUrl.protocol) !== undefined | ||||
); | ); | ||||
} | } | ||||
if (validUrl && originType === 'git') { | if (validUrl && originType === 'git') { | ||||
// additional checks for well known code hosting providers | // additional checks for well known code hosting providers | ||||
switch (originUrl.hostname) { | switch (originUrl.hostname) { | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |