Author: metaweta
Date: Thu Jan  8 14:27:41 2009
New Revision: 3167

Modified:
   trunk/src/com/google/caja/plugin/FileSystemEnvironment.java

Log:
Issue 11707  http://codereview.appspot.com/11707
Allow <a href="#">

FileSystemEnvironment.java currently prohibits
any URL that refers to anything but a file in the
same directory; this weakens the prohibition slightly
to allow the url "#" which is commonly used when
attaching onclick behavior to a link instead of using
the link for navigating the browser.

[email protected]


Modified: trunk/src/com/google/caja/plugin/FileSystemEnvironment.java
==============================================================================
--- trunk/src/com/google/caja/plugin/FileSystemEnvironment.java (original)
+++ trunk/src/com/google/caja/plugin/FileSystemEnvironment.java Thu Jan 8 14:27:41 2009
@@ -48,7 +48,11 @@

   public String rewriteUri(ExternalReference ref, String mimeType) {
     File f = toFileUnderSameDirectory(ref.getUri());
-    if (f == null) { return null; }
+    if (f == null) {
+      String uristr = ref.getUri().toString();
+      if (uristr == "#") { return uristr; }
+      else { return null; }
+    }
return new File(directory, ".").toURI().relativize(f.toURI()).toString();
   }

Reply via email to