summaryrefslogtreecommitdiffstats
path: root/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/links.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/utils/links.js b/lib/utils/links.js
index 6606bbf..b4d2fb7 100644
--- a/lib/utils/links.js
+++ b/lib/utils/links.js
@@ -3,14 +3,22 @@ var path = require('path');
// Is the link an external link
var isExternal = function(href) {
- return Boolean(url.parse(href).protocol);
+ try {
+ return Boolean(url.parse(href).protocol);
+ } catch(err) { }
+
+ return false;
};
// Return true if the link is relative
var isRelative = function(href) {
- var parsed = url.parse(href);
+ try {
+ var parsed = url.parse(href);
+
+ return !parsed.protocol && parsed.path && parsed.path[0] != '/';
+ } catch(err) {}
- return !parsed.protocol && parsed.path && parsed.path[0] != '/';
+ return true;
};
// Relative to absolute path