Normalize discogs artist urls

This commit is contained in:
Laurent Monin 2015-06-05 23:28:09 +02:00
parent beef49f3e1
commit 3b3ea553f6

View file

@ -131,10 +131,10 @@ function magnifyLinks(rootNode) {
// Normalize Discogs URL by removing title from URL // Normalize Discogs URL by removing title from URL
function magnifyLink(url) { function magnifyLink(url) {
var re = /^http:\/\/www\.discogs\.com\/(.*)\/(master|release)\/(\d+)$/i; var re = /^http:\/\/www\.discogs\.com\/(?:.+\/)?(master|release|artist)\/(\d+)(?:-[^\/#?]+)?$/i;
if (m = re.exec(url)) { if (m = re.exec(url)) {
var type = m[2]; var type = m[1];
var id = m[3]; var id = m[2];
return "http://www.discogs.com/" + type + "/" + id; return "http://www.discogs.com/" + type + "/" + id;
} }
return url; return url;