diff OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 1597:415dfd1d1c61

Improvements to the sample "ServeFolders" plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Aug 2015 13:47:23 +0200
parents f967bdf8534e
children ffd23c0104af
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Thu Aug 27 15:36:43 2015 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Fri Aug 28 13:47:23 2015 +0200
@@ -167,7 +167,17 @@
       const char *c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_RootUri);
       if (c != NULL)
       {
-        v["RootUri"] = c;
+        std::string root = c;
+        if (!root.empty())
+        {
+          // Turn the root URI into a URI relative to "/app/explorer.js"
+          if (root[0] == '/')
+          {
+            root = ".." + root;
+          }
+
+          v["RootUri"] = root;
+        }
       }
 
       c = plugins.GetProperty(id.c_str(), _OrthancPluginProperty_Description);