diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index daec84492..ac214d1d4 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -103,9 +103,11 @@ function sendPadHeaderFiles(res, callback){ if(key === "ep_etherpad-lite") return; var plugin = plugins[key]; var client_hooks = plugin.parts[0].client_hooks; - Object.keys(client_hooks).forEach(function(k){ - pluginPaths.push(client_hooks[k]); - }); + if(client_hooks){ + Object.keys(client_hooks).forEach(function(k){ + pluginPaths.push(client_hooks[k]); + }); + } }); // Now we need to uniquify the array so we only have unique paths @@ -114,12 +116,14 @@ function sendPadHeaderFiles(res, callback){ }) // Next to join the array into a string so we can add it to the link value - var uniquePluginString = "'"; + var uniquePluginString = ""; for (var i = 0; i < uniquePaths.length; i++) { - uniquePluginString += "<"+uniquePaths[i]+".js>; rel=prefetch\,"; + uniquePluginString += "; rel=prefetch\, "; } + // console.log("unique plugin string...", uniquePluginString) + res.set('Link', uniquePluginString + " ; rel=prefetch\, \ ; rel=prefetch\, \ ; rel=prefetch\, \ @@ -133,6 +137,6 @@ function sendPadHeaderFiles(res, callback){ ; rel=prefetch\, \ ; rel=prefetch\, \ ; rel=prefetch\, \ -; rel=prefetch'"); +; rel=prefetch"); callback(); }