summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2013-10-15 14:01:12 +1100
committerDoug Kearns <dougkearns@gmail.com>2013-10-15 14:01:12 +1100
commitecaa01d3b28a3bbab696acd88c5957754fd69960 (patch)
tree0383e358b28e8c90a43f64b5c3431c68a9f1f21b
parentb840612bb8ed9168b755a7a19a1495f6dc0dde2f (diff)
downloadpentadactyl-ecaa01d3b28a3bbab696acd88c5957754fd69960.tar.gz
Don't run the YouTube URL shortner on non-video pages.
-rw-r--r--common/modules/buffer.jsm9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm
index 1b8695dd..f4092a35 100644
--- a/common/modules/buffer.jsm
+++ b/common/modules/buffer.jsm
@@ -2708,10 +2708,11 @@ Buffer.addPageInfoSection("s", "Security", function (verbose) {
});
// internal navigation doesn't currently update link[rel='shortlink']
-Buffer.addURIShortener("youtube.com", (uri, doc) =>
- util.newURI("http://youtu.be/" +
- array.toObject(uri.query.split("&")
- .map(p => p.split("="))).v));
+Buffer.addURIShortener("youtube.com", (uri, doc) => {
+ let video = array.toObject(uri.query.split("&")
+ .map(p => p.split("="))).v;
+ return video ? util.newURI("http://youtu.be/" + video) : null;
+});
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }