[google-caja] r4097 committed - Resolve non-cannoical file system names correctly...

0 views
Skip to first unread message

googl...@googlecode.com

unread,
May 28, 2010, 8:22:41 PM5/28/10
to caja....@gmail.com
Revision: 4097
Author: jasvir
Date: Fri May 28 17:22:14 2010
Log: Resolve non-cannoical file system names correctly
http://codereview.appspot.com/1364041

PluginCompilerMain tested for equality of two directories based equality of
their abstract pathnames. In this case:
"./mootools" is not the same as "././mootools". This change cannoncalizes
the pathnames before carrying out the comparison

R=meta...@gmail.com

http://code.google.com/p/google-caja/source/detail?r=4097

Modified:
/trunk/src/com/google/caja/plugin/PluginCompilerMain.java
/trunk/src/com/google/caja/plugin/UriToFile.java

=======================================
--- /trunk/src/com/google/caja/plugin/PluginCompilerMain.java Wed May 12
15:10:26 2010
+++ /trunk/src/com/google/caja/plugin/PluginCompilerMain.java Fri May 28
17:22:14 2010
@@ -125,6 +125,9 @@
} catch (IllegalArgumentException ex) { // Not a file: URI
fetcher = UriFetcher.NULL_NETWORK;
policy = UriPolicy.CLOSED_PLUGIN_ENVIRONMENT;
+ } catch (IOException e) { // Could not resolve file name
+ fetcher = UriFetcher.NULL_NETWORK;
+ policy = UriPolicy.CLOSED_PLUGIN_ENVIRONMENT;
}

PluginMeta meta = new PluginMeta(fetcher, policy);
=======================================
--- /trunk/src/com/google/caja/plugin/UriToFile.java Tue May 25 12:11:32
2010
+++ /trunk/src/com/google/caja/plugin/UriToFile.java Fri May 28 17:22:14
2010
@@ -17,13 +17,15 @@
import com.google.caja.util.Function;

import java.io.File;
+import java.io.IOException;
import java.net.URI;

class UriToFile implements Function<URI, File> {
final File directory;

- public UriToFile(File directory) {
- this.directory = directory;
+ public UriToFile(File directory) throws IOException {
+ assert directory.isDirectory();
+ this.directory = directory.getCanonicalFile();
}

public File apply(URI uri) {

Reply all
Reply to author
Forward
0 new messages