# HG changeset patch
# User Alain Mazy <am@osimis.io>
# Date 1710407042 -3600
# Node ID 1c8515124f27ddf9537b840ca824123589c3e616
# Parent  640041ec70aa25f447de5fb5897389f099e89b0e
patch OHIF for https://github.com/OHIF/Viewers/issues/3928

diff -r 640041ec70aa -r 1c8515124f27 NEWS
--- a/NEWS	Thu Jan 04 15:39:16 2024 +0100
+++ b/NEWS	Thu Mar 14 10:04:02 2024 +0100
@@ -1,6 +1,9 @@
 Pending changes in the mainline
 ===============================
 
+* Patching OHIF code for https://github.com/OHIF/Viewers/issues/3928
+  to allow using token args in url.
+
 
 Version 1.2 (2024-01-04)
 ========================
diff -r 640041ec70aa -r 1c8515124f27 Sources/Plugin.cpp
--- a/Sources/Plugin.cpp	Thu Jan 04 15:39:16 2024 +0100
+++ b/Sources/Plugin.cpp	Thu Mar 14 10:04:02 2024 +0100
@@ -249,6 +249,13 @@
 
     std::unique_ptr<std::string> item(new std::string);
     ReadStaticAsset(*item, path);
+
+    // patch OHIF for https://github.com/OHIF/Viewers/issues/3928
+    if (Orthanc::Toolbox::StartsWith(path, "app.bundle."))
+    {
+      boost::replace_all(*item, "window.location.origin + location.pathname + location.search", "window.location.origin + window.location.pathname + location.search");
+    }
+
     OrthancPluginAnswerBuffer(context, output, item->c_str(), item->size(), mime.c_str());
 
     {