Title: [547] trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java: handle absolute paths correctly
Revision
547
Author
tirsen
Date
2007-05-06 23:52:47 -0400 (Sun, 06 May 2007)

Log Message

handle absolute paths correctly

Modified Paths


Diff

Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java (546 => 547)


--- trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java	2007-05-06 21:37:05 UTC (rev 546)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/FileServlet.java	2007-05-07 03:52:47 UTC (rev 547)
@@ -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)) {
+            if (new File(directory).isAbsolute()) {
+                realPath = directory + relativePath;
+            } else {
                 realPath = rootPath + File.separator + directory + relativePath;
-            } else {
-                realPath = directory + relativePath;
             }
             realPath = realPath.replaceAll("\\\\", "/").replaceAll("//", "/");
 
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to