From 92a3d430641fdeef2c2f0d2018daf3f27dff5ed3 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 3 Jun 2013 13:57:58 +0200 Subject: [PATCH] webbuild.js: improved 'Start from URL' filename parsing --- webbuild/html/scripts/webbuild.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webbuild/html/scripts/webbuild.js b/webbuild/html/scripts/webbuild.js index 049578c..2ec2ce4 100644 --- a/webbuild/html/scripts/webbuild.js +++ b/webbuild/html/scripts/webbuild.js @@ -43,9 +43,18 @@ function suggestSpecName(url) { e != ".orig") break; specname=specname.substring(0,i); } + i=specname.lastIndexOf('_'); + e=specname.substring(i); + if (e == "_src" || e == "_orig") specname=specname.substring(0,i); + i=specname.lastIndexOf('-'); + e=specname.substring(i); + if (e == "-src" || e == "-orig") specname=specname.substring(0,i); if (specname.lastIndexOf('-') > 0) { version=specname.substring(specname.lastIndexOf('-')+1); specname=specname.substring(0,specname.lastIndexOf('-')); + } else if (specname.lastIndexOf('_') > 0) { + version=specname.substring(specname.lastIndexOf('_')+1); + specname=specname.substring(0,specname.lastIndexOf('_')); } document.getElementById("speccreateurl").value=url; if (url.search("cpan.org") >= 0) {