From ce790c7569871b76ed6247206f1822205b93c401 Mon Sep 17 00:00:00 2001
From: Vincent Bechu <vincent.bechu@nexedi.com>
Date: Mon, 30 Oct 2017 14:03:23 +0000
Subject: [PATCH] [erp5_officejs] Use the proper object to build url in
 appcache storage

---
 .../gadget_officejs_jio_appcachestorage_js.js          | 10 ++++++----
 .../gadget_officejs_jio_appcachestorage_js.xml         |  6 +++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.js b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.js
index 65296a3db7..f48dab8263 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.js
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.js
@@ -57,13 +57,14 @@
           return new Blob([]);
         });
     }
+    if (relative_url === '/') {
+      relative_url = '';
+    }
     return new RSVP.Queue()
       .push(function () {
         return jIO.util.ajax({
           type: "GET",
-          url: (relative_url.startsWith("http") ||
-                relative_url.startsWith("//")) ?
-                relative_url : origin_url + relative_url,
+          url: new URL(relative_url, origin_url),
           dataType: "blob"
         });
       })
@@ -106,7 +107,8 @@
       .push(function () {
         return jIO.util.ajax({
           type: "GET",
-          url: storage._origin_url + storage._version + storage._manifest
+          url: new URL(storage._manifest, new URL(storage._version,
+                       storage._origin_url))
         });
       })
       .push(function (response) {
diff --git a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.xml b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.xml
index 5ab62720ca..db912b3ede 100644
--- a/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.xml
+++ b/bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_appcachestorage_js.xml
@@ -225,7 +225,7 @@
             </item>
             <item>
                 <key> <string>actor</string> </key>
-                <value> <string>vincent</string> </value>
+                <value> <string>zope</string> </value>
             </item>
             <item>
                 <key> <string>comment</string> </key>
@@ -239,7 +239,7 @@
             </item>
             <item>
                 <key> <string>serial</string> </key>
-                <value> <string>963.7741.10364.409</string> </value>
+                <value> <string>963.8873.18455.40004</string> </value>
             </item>
             <item>
                 <key> <string>state</string> </key>
@@ -257,7 +257,7 @@
                     </tuple>
                     <state>
                       <tuple>
-                        <float>1509371482.86</float>
+                        <float>1509439359.17</float>
                         <string>UTC</string>
                       </tuple>
                     </state>
-- 
2.30.9