Title: [602] branches/rails-integration/1.2/src/main/java/org/jruby/webapp/FileServlet.java: Backport fix from trunk for FileServlet directory parameter problem.
- Revision
- 602
- Author
- tantalon
- Date
- 2007-05-24 18:09:35 -0400 (Thu, 24 May 2007)
Log Message
Backport fix from trunk for FileServlet directory parameter problem.
Modified Paths
Diff
Modified: branches/rails-integration/1.2/src/main/java/org/jruby/webapp/FileServlet.java (601 => 602)
--- branches/rails-integration/1.2/src/main/java/org/jruby/webapp/FileServlet.java 2007-05-24 21:15:42 UTC (rev 601)
+++ branches/rails-integration/1.2/src/main/java/org/jruby/webapp/FileServlet.java 2007-05-24 22:09:35 UTC (rev 602)
@@ -79,10 +79,10 @@
String realPath;
// if it's relative prepend the web apps root, otherwise just use this path
- if (directory.startsWith(File.separator)) {
- realPath = rootPath + File.separator + directory + relativePath;
- } else {
+ if (new File(directory).isAbsolute()) {
realPath = directory + relativePath;
+ } else {
+ realPath = rootPath + File.separator + directory + relativePath;
}
realPath = realPath.replaceAll("\\\\", "/").replaceAll("//", "/");
@@ -144,8 +144,7 @@
.getMessage());
} finally {
try {
- if (in != null)
- in.close();
+ if (in != null) in.close();
} catch (IOException ignore) {
}
}
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel