Reviewers: jasvir,
Description:
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.
Please review this at http://codereview.appspot.com/11707
Affected files:
M src/com/google/caja/plugin/FileSystemEnvironment.java
Index: src/com/google/caja/plugin/FileSystemEnvironment.java
===================================================================
--- src/com/google/caja/plugin/FileSystemEnvironment.java (revision 3166)
+++ src/com/google/caja/plugin/FileSystemEnvironment.java (working copy)
@@ -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();
}