OSDN Git Service

minor update.
[hmh/hhml.git] / lib / util_file.cc
index 6c95440..a7810c7 100644 (file)
@@ -100,6 +100,7 @@ void  shapePath (ustring& path) {
     static uregex  re1 ("//+");
     static uregex  re2 ("[^/]+/\\.\\.(/|$)");
     static uregex  re3 ("(/|^)\\.(/|$)");
+    static uregex  re4 ("^/\\.\\./");
     umatch  m;
     uiterator  b, e;
 
@@ -135,6 +136,10 @@ void  shapePath (ustring& path) {
            assert (0);
        }
     }
+    while (usearch (path, m, re4)) {
+       e = path.end ();
+       path = ustring (m[0].second - 1, e);
+    }
  Bp1:;
 }