From 3b3ea553f6f504ba224710efcf1e8d5687810578 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Fri, 5 Jun 2015 23:28:09 +0200 Subject: [PATCH] Normalize discogs artist urls --- discogs_importer.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discogs_importer.user.js b/discogs_importer.user.js index 61d6936..cde4153 100644 --- a/discogs_importer.user.js +++ b/discogs_importer.user.js @@ -131,10 +131,10 @@ function magnifyLinks(rootNode) { // Normalize Discogs URL by removing title from 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)) { - var type = m[2]; - var id = m[3]; + var type = m[1]; + var id = m[2]; return "http://www.discogs.com/" + type + "/" + id; } return url;