Fix website badge for deep links (#720)

Works: https://img.shields.io/website/http/github.com.svg
Does not work: https://img.shields.io/website/http/github.com/badges.svg

Regexp was too greedy and included the beginning of the path in the protocol
This commit is contained in:
Georges Dupéron 2017-04-19 05:55:19 +02:00 committed by Paul Melnikow
parent 5a8b565ebb
commit 26847dca80

View File

@ -5833,7 +5833,7 @@ cache(function(data, match, sendBadge, request) {
}));
// Test if a webpage is online
camp.route(/^\/website(-(([^-]|--)*?)-(([^-]|--)*)(-(([^-]|--)+)-(([^-]|--)+))?)?\/(.+)\/(.+)\.(svg|png|gif|jpg|json)$/,
camp.route(/^\/website(-(([^-]|--)*?)-(([^-]|--)*)(-(([^-]|--)+)-(([^-]|--)+))?)?\/([^/]+)\/(.+)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var onlineMessage = escapeFormat(match[2] != null ? match[2] : "online");
var offlineMessage = escapeFormat(match[4] != null ? match[4] : "offline");