Resolve #blah URI references properly.
authorCameron McCormack <cam@mcc.id.au>
Sun, 19 Aug 2012 16:34:08 +1000
changeset 53 1dc1bc93bcf9
parent 52 cc6446c2e16e
child 54 455af9540770
Resolve #blah URI references properly.
publish/utils.js
--- a/publish/utils.js	Sun Aug 19 16:27:16 2012 +1000
+++ b/publish/utils.js	Sun Aug 19 16:34:08 2012 +1000
@@ -117,6 +117,9 @@
 exports.resolveURL = function(base, url) {
   if (!base) return url;
   if (url[0] == '/') throw "can't handle absolute paths";
+  if (url[0] == '#') {
+    return base.replace(/#.*/, url);
+  }
   return base.replace(/[^\/]*$/, '') + url;
 };