Skip to content
Snippets Groups Projects

AFN: validate the provided forge URL more extensively

Merged Paul Wise requested to merge pabs/swh-web:validate-afn-urls into master
1 unresolved thread
1 file
+ 18
4
Compare changes
  • Side-by-side
  • Inline
@@ -136,7 +136,12 @@ export function populateRequestBrowseList() {
}
function isGitHubUrl(url) {
const originUrl = new URL(url);
let originUrl;
try {
originUrl = new URL(url);
} catch (_) {
return false;
}
const hostname = originUrl.hostname;
const github = ['github.com', 'www.github.com'];
@@ -153,7 +158,12 @@ function isGitHubUrl(url) {
}
function isMissingSlash(url) {
const originUrl = new URL(url);
let originUrl;
try {
originUrl = new URL(url);
} catch (_) {
return false;
}
return originUrl.origin === url;
}
@@ -352,9 +362,13 @@ const stagitPathnameExtraRe = RegExpX(`
)$`);
function getUrlExtra(url) {
const originUrl = new URL(url);
let originUrl;
try {
originUrl = new URL(url);
} catch (_) {
return null;
}
let m = null;
const forgeType = $('#swh-input-forge-type').val();
if (forgeType === 'bitbucket') {
m = bitbucketPathnameExtraRe.exec(originUrl.pathname);
Loading