Add line start anchors to the shorthand URI parsers

This commit is contained in:
Xaekai 2015-02-21 12:26:03 -08:00
parent a291cfecb4
commit 1c263f825b
1 changed files with 3 additions and 3 deletions

View File

@ -1317,21 +1317,21 @@ function parseMediaLink(url) {
/* Shorthand URIs */ /* Shorthand URIs */
// To catch Google Plus by ID alone // To catch Google Plus by ID alone
if ((m = url.match(/(?:gp:)?(\d{21}_\d{19}_\d{19})/))) { if ((m = url.match(/^(?:gp:)?(\d{21}_\d{19}_\d{19})/))) {
return { return {
id: m[1], id: m[1],
type: "gp" type: "gp"
}; };
} }
// So we still trim DailyMotion URLs // So we still trim DailyMotion URLs
if((m = url.match(/dm:([^\?&#_]+)/))) { if((m = url.match(/^dm:([^\?&#_]+)/))) {
return { return {
id: m[1], id: m[1],
type: "dm" type: "dm"
}; };
} }
// Generic for the rest. // Generic for the rest.
if ((m = url.match(/([a-z]{2}):([^\?&#]+)/))) { if ((m = url.match(/^([a-z]{2}):([^\?&#]+)/))) {
return { return {
id: m[2], id: m[2],
type: m[1] type: m[1]