From 165d30d7429c815cf5ef35fba7113980b4b0b3ca Mon Sep 17 00:00:00 2001 From: Andy Gup Date: Tue, 12 Jul 2016 16:48:38 -0600 Subject: [PATCH 1/3] Add uri encoding to edit advanced library --- lib/edit/OfflineEditAdvanced.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/edit/OfflineEditAdvanced.js b/lib/edit/OfflineEditAdvanced.js index 6ff78629..b9e5c11b 100644 --- a/lib/edit/OfflineEditAdvanced.js +++ b/lib/edit/OfflineEditAdvanced.js @@ -2017,7 +2017,7 @@ define([ delete add.infoTemplate; // delete it to reduce payload size. } }, this); - a = "&adds=" + JSON.stringify((adds)); + a = "&adds=" + encodeURIComponent(JSON.stringify(adds)); } if(updates.length > 0) { array.forEach(updates, function(update){ @@ -2025,7 +2025,7 @@ define([ delete update.infoTemplate; // delete it to reduce payload size. } }, this); - u = "&updates=" + JSON.stringify(updates); + u = "&updates=" + encodeURIComponent(JSON.stringify(updates)); } if(deletes.length > 0) { var id = deletes[0].attributes[this.DB_UID]; From 39380c6755beec8f33e0e51f8186e8dcaaffc0d5 Mon Sep 17 00:00:00 2001 From: Andy Gup Date: Tue, 12 Jul 2016 16:48:49 -0600 Subject: [PATCH 2/3] Add uri encoding to edit basic library --- lib/edit/OfflineEditBasic.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/edit/OfflineEditBasic.js b/lib/edit/OfflineEditBasic.js index 1b5dd0be..af20c0e8 100644 --- a/lib/edit/OfflineEditBasic.js +++ b/lib/edit/OfflineEditBasic.js @@ -928,7 +928,7 @@ define([ delete add.infoTemplate; // delete it to reduce payload size. } }, this); - a = "&adds=" + JSON.stringify((adds)); + a = "&adds=" + encodeURIComponent(JSON.stringify(adds)); } if(updates.length > 0) { array.forEach(updates, function(update){ @@ -936,7 +936,7 @@ define([ delete update.infoTemplate; // delete it to reduce payload size. } }, this); - u = "&updates=" + JSON.stringify(updates); + u = "&updates=" + encodeURIComponent(JSON.stringify(updates)); } if(deletes.length > 0) { var id = deletes[0].attributes[this.DB_UID]; From 63f20916ed22204c56799be72e9d1609d9a0fed2 Mon Sep 17 00:00:00 2001 From: Andy Gup Date: Tue, 12 Jul 2016 16:49:16 -0600 Subject: [PATCH 3/3] v3.3 --- CHANGELOG.md | 12 ++++++++++++ dist/offline-edit-advanced-min.js | 2 +- dist/offline-edit-advanced-src.js | 6 +++--- dist/offline-edit-basic-min.js | 2 +- dist/offline-edit-basic-src.js | 6 +++--- dist/offline-tiles-advanced-src.js | 2 +- dist/offline-tiles-basic-src.js | 2 +- dist/offline-tpk-src.js | 2 +- package.json | 2 +- samples/appcache-features.html | 2 +- samples/package.json | 2 +- 11 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32002ebe..91d2b71b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # offline-editor-js - Changelog +## Version 3.3.0 - June 12, 2016 + +No breaking changes. + +**Enhancements** +* Closes #473 - offline edits breaking when special characters such as "&" are used within attribute values. + +## Changed deprecation notice to Maintenance Mode notice - June 1, 2016 + +Per several requests, this hopefully clarifies that the library is still being maintained and not being +removed. + ## Deprecation details - May 23, 2016 For details and comments on the deprecation refer to this [issue](https://github.com/Esri/offline-editor-js/issues/468). diff --git a/dist/offline-edit-advanced-min.js b/dist/offline-edit-advanced-min.js index 3d554d7c..de046a06 100644 --- a/dist/offline-edit-advanced-min.js +++ b/dist/offline-edit-advanced-min.js @@ -120,7 +120,7 @@ e.length>0&&e[0].success&&(h=e[0].objectId),f.length>0&&f[0].success&&(h=f[0].ob var i={} return i.attributes={},i.attributes[this.DB_UID]=h,this._editStore["delete"](a.url,i,function(a,b){if(a){var c=this._editStore.PHANTOM_GRAPHIC_PREFIX+this._editStore._PHANTOM_PREFIX_TOKEN+i.attributes[this.DB_UID] this._editStore.deletePhantomGraphic(c,function(a,b){a?g.resolve({success:!0,error:null,id:c}):g.reject({success:!1,error:b,id:c})})}else g.reject({success:!1,error:b,id:c})}.bind(this)),g.promise},_makeEditRequest:function(a,b,c,d,f,g){var h="f=json",i="",j="",k="" -if(b.length>0&&(e.forEach(b,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),i="&adds="+JSON.stringify(b)),c.length>0&&(e.forEach(c,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),j="&updates="+JSON.stringify(c)),d.length>0){var l=d[0].attributes[this.DB_UID] +if(b.length>0&&(e.forEach(b,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),i="&adds="+encodeURIComponent(JSON.stringify(b))),c.length>0&&(e.forEach(c,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),j="&updates="+encodeURIComponent(JSON.stringify(c))),d.length>0){var l=d[0].attributes[this.DB_UID] k="&deletes="+l}var m=h+i+j+k a.hasOwnProperty("credential")&&a.credential&&a.credential.hasOwnProperty("token")&&a.credential.token&&(m=m+"&token="+a.credential.token) var n=this.proxyPath?this.proxyPath+"?"+a.url:a.url,o=new XMLHttpRequest diff --git a/dist/offline-edit-advanced-src.js b/dist/offline-edit-advanced-src.js index 039e003b..eb953c22 100644 --- a/dist/offline-edit-advanced-src.js +++ b/dist/offline-edit-advanced-src.js @@ -1,4 +1,4 @@ -/*! esri-offline-maps - v3.2.0 - 2016-05-12 +/*! esri-offline-maps - v3.3.0 - 2016-07-12 * Copyright (c) 2016 Environmental Systems Research Institute, Inc. * Apache License*/ // Configure offline/online detection @@ -2033,7 +2033,7 @@ define([ delete add.infoTemplate; // delete it to reduce payload size. } }, this); - a = "&adds=" + JSON.stringify((adds)); + a = "&adds=" + encodeURIComponent(JSON.stringify(adds)); } if(updates.length > 0) { array.forEach(updates, function(update){ @@ -2041,7 +2041,7 @@ define([ delete update.infoTemplate; // delete it to reduce payload size. } }, this); - u = "&updates=" + JSON.stringify(updates); + u = "&updates=" + encodeURIComponent(JSON.stringify(updates)); } if(deletes.length > 0) { var id = deletes[0].attributes[this.DB_UID]; diff --git a/dist/offline-edit-basic-min.js b/dist/offline-edit-basic-min.js index 819844f4..10819e73 100644 --- a/dist/offline-edit-basic-min.js +++ b/dist/offline-edit-basic-min.js @@ -53,7 +53,7 @@ a.add(j)}h._cleanDatabase(a,d,b,f,g).then(function(e){i.resolve({id:c,layer:a.ur e.length>0&&e[0].success&&(h=e[0].objectId),f.length>0&&f[0].success&&(h=f[0].objectId),d.length>0&&d[0].success&&(h=c) var i={} return i.attributes={},i.attributes[this.DB_UID]=h,this._editStore["delete"](a.url,i,function(a,b){a?g.resolve({success:!0,error:null,id:h}):g.reject({success:!1,error:b,id:h})}),g.promise},_makeEditRequest:function(a,b,c,d,f,g){var h="f=json",i="",j="",k="" -if(b.length>0&&(e.forEach(b,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),i="&adds="+JSON.stringify(b)),c.length>0&&(e.forEach(c,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),j="&updates="+JSON.stringify(c)),d.length>0){var l=d[0].attributes[this.DB_UID] +if(b.length>0&&(e.forEach(b,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),i="&adds="+encodeURIComponent(JSON.stringify(b))),c.length>0&&(e.forEach(c,function(a){a.hasOwnProperty("infoTemplate")&&delete a.infoTemplate},this),j="&updates="+encodeURIComponent(JSON.stringify(c))),d.length>0){var l=d[0].attributes[this.DB_UID] k="&deletes="+l}var m=h+i+j+k a.hasOwnProperty("credential")&&a.credential&&a.credential.hasOwnProperty("token")&&a.credential.token&&(m=m+"&token="+a.credential.token) var n=this.proxyPath?this.proxyPath+"?"+a.url:a.url,o=new XMLHttpRequest diff --git a/dist/offline-edit-basic-src.js b/dist/offline-edit-basic-src.js index 61a34a24..3205403e 100644 --- a/dist/offline-edit-basic-src.js +++ b/dist/offline-edit-basic-src.js @@ -1,4 +1,4 @@ -/*! esri-offline-maps - v3.2.0 - 2016-05-12 +/*! esri-offline-maps - v3.3.0 - 2016-07-12 * Copyright (c) 2016 Environmental Systems Research Institute, Inc. * Apache License*/ // Configure offline/online detection @@ -944,7 +944,7 @@ define([ delete add.infoTemplate; // delete it to reduce payload size. } }, this); - a = "&adds=" + JSON.stringify((adds)); + a = "&adds=" + encodeURIComponent(JSON.stringify(adds)); } if(updates.length > 0) { array.forEach(updates, function(update){ @@ -952,7 +952,7 @@ define([ delete update.infoTemplate; // delete it to reduce payload size. } }, this); - u = "&updates=" + JSON.stringify(updates); + u = "&updates=" + encodeURIComponent(JSON.stringify(updates)); } if(deletes.length > 0) { var id = deletes[0].attributes[this.DB_UID]; diff --git a/dist/offline-tiles-advanced-src.js b/dist/offline-tiles-advanced-src.js index 9e1b1f9b..fcfa5609 100644 --- a/dist/offline-tiles-advanced-src.js +++ b/dist/offline-tiles-advanced-src.js @@ -1,4 +1,4 @@ -/*! esri-offline-maps - v3.2.0 - 2016-05-12 +/*! esri-offline-maps - v3.3.0 - 2016-07-12 * Copyright (c) 2016 Environmental Systems Research Institute, Inc. * Apache License*/ define([ diff --git a/dist/offline-tiles-basic-src.js b/dist/offline-tiles-basic-src.js index d9653d29..769fba4e 100644 --- a/dist/offline-tiles-basic-src.js +++ b/dist/offline-tiles-basic-src.js @@ -1,4 +1,4 @@ -/*! esri-offline-maps - v3.2.0 - 2016-05-12 +/*! esri-offline-maps - v3.3.0 - 2016-07-12 * Copyright (c) 2016 Environmental Systems Research Institute, Inc. * Apache License*/ define([ diff --git a/dist/offline-tpk-src.js b/dist/offline-tpk-src.js index 0e38d419..6fd468f7 100644 --- a/dist/offline-tpk-src.js +++ b/dist/offline-tpk-src.js @@ -1,4 +1,4 @@ -/*! esri-offline-maps - v3.2.0 - 2016-05-12 +/*! esri-offline-maps - v3.3.0 - 2016-07-12 * Copyright (c) 2016 Environmental Systems Research Institute, Inc. * Apache License*/ /** diff --git a/package.json b/package.json index 4cf9c3dd..ba5bc250 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "esri-offline-maps", - "version": "3.2.0", + "version": "3.3.0", "description": "Lightweight set of libraries for working offline with map tiles and editing with ArcGIS feature services", "author": "Andy Gup (http://blog.andygup.net)", "license": "Apache 2.0", diff --git a/samples/appcache-features.html b/samples/appcache-features.html index 8d93fbbc..e6533ad6 100644 --- a/samples/appcache-features.html +++ b/samples/appcache-features.html @@ -1,5 +1,5 @@ - + diff --git a/samples/package.json b/samples/package.json index bf6a96df..942db50c 100644 --- a/samples/package.json +++ b/samples/package.json @@ -9,7 +9,7 @@ "appHomePage": "appcache-tiles.html", "optimizedApiURL": "../samples/jsolib", "arcGISBaseURL": "http://js.arcgis.com/3.14", - "version": "3.2.0", + "version": "3.3.0", "private": true, "description": "manifest generator project", "repository": {