48272e481ae9768378a88da5019d61706e9feb9c
angie
  Fri Mar 10 11:12:53 2017 -0800
Libify the hgTables fix for problematic characters in download filenames and apply to hgVai, hgIntegrator and hgSession.  Thanks Jairo! refs #18931 note-10

diff --git src/hg/hgSession/hgSession.c src/hg/hgSession/hgSession.c
index c16898d..b6836e9 100644
--- src/hg/hgSession/hgSession.c
+++ src/hg/hgSession/hgSession.c
@@ -1189,31 +1189,31 @@
 	       getSessionLink(otherUser, encSessionName),
 	       getSessionEmailLink(encOtherUser, encSessionName));
 cartLoadUserSession(conn, otherUser, sessionName, cart, NULL, actionVar);
 cartHideDefaultTracks(cart);
 hubConnectLoadHubs(cart);
 cartCopyCustomTracks(cart);
 cartCheckForCustomTracks(cart, dyMessage);
 hDisconnectCentral(&conn);
 return dyStringCannibalize(&dyMessage);
 }
 
 void doSaveLocal()
 /* Output current settings to be saved as a file on the user's machine.
  * Return a message confirming what we did. */
 {
-char *fileName = trimSpaces(cartString(cart, hgsSaveLocalFileName));
+char *fileName = textOutSanitizeHttpFileName(cartString(cart, hgsSaveLocalFileName));
 char *compressType = cartString(cart, hgsSaveLocalFileCompress);
 struct pipeline *compressPipe = textOutInit(fileName, compressType, NULL);
 
 cleanHgSessionFromCart(cart);
 cartDump(cart);
 
 // Now add all the default visibilities to output.
 outDefaultTracks(cart, NULL);
 
 textOutClose(&compressPipe, NULL);
 }
 
 char *doLoad(boolean fromUrl, char *actionVar)
 /* Load settings from a file or URL sent by the user.
  * Return a message confirming what we did. */