8043b90858fce6a2f40909d793062cff4b431425
galt
  Fri Apr 11 15:09:50 2025 -0700
Fixes missing uri encoding in url for ajax callback. fixes #34751

diff --git src/hg/js/hgCollection.js src/hg/js/hgCollection.js
index 95e5645eae7..8a140eb7442 100644
--- src/hg/js/hgCollection.js
+++ src/hg/js/hgCollection.js
@@ -241,30 +241,31 @@
         var v = $(selectedTree).jstree(true).get_json('#', {flat:true, no_data:true, no_state:true, no_a_attr:true});
         var children;
         var parents = {};
         for(ii=0; ii < v.length; ii++) {
             if (v[ii].parent === '#') {
                 parents[v[ii].id] = v[ii].text;
             }
         }
         for(ii=0; ii < v.length; ii++) { 
             if (v[ii].li_attr.name === undefined) {
                 alert(parents[v[ii].parent] + " does not have any wiggles.  Not saved.");
             }
         }
         json += JSON.stringify(v);
         json += ']';
+        json = encodeURIComponent(json);  // encodes , / ? : @ & = + $ # and special characters.
         var requestData = 'jsonp=' + json + '&hgsid=' + getHgsid();
         $.ajax({
             data:  requestData ,
             async: doAjaxAsync,
             dataType: "JSON",
             type: "PUT",
             url: "hgCollection?cmd=saveCollection",
             trueSuccess: updatePage,
             success: catchErrorOrDispatch,
             error: errorHandler,
         });
     }
 
     function saveCollections(trees) {
         // called when the "Save" button is pressed