d8357a44b9fb15ee8262a36d4fbcc43c90fae358 chmalee Mon Dec 14 16:42:26 2020 -0800 Make hgGateway use previously browsed position when changing databases, also fix hgHubConnect assembly redirect to use last used position, refs #14481 diff --git src/hg/lib/cart.c src/hg/lib/cart.c index f9cd742..8202c14 100644 --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@ -3463,31 +3463,33 @@ /* get the current position in cart as a string chr:start-end. * This can handle the special CGI params 'default' and 'lastDbPos' * Returned value has to be freed. Returns * default position of assembly is no position set in cart nor as CGI var. * Returns NULL if no position set anywhere and no default position. * For virtual modes, returns the type and extraState. */ { // position=lastDbPos in URL? -> go back to the last browsed position for this db char *position = NULL; char *defaultPosition = hDefaultPos(database); struct cart *lastDbPosCart = cartOfNothing(); boolean gotCart = FALSE; char dbPosKey[256]; safef(dbPosKey, sizeof(dbPosKey), "position.%s", database); -if (sameOk(cgiOptionalString("position"), "lastDbPos")) + +// use cartCgiUsualString in case request is coming via ajax call from hgGateway +if (sameOk(cartCgiUsualString(cart, "position", NULL), "lastDbPos")) { char *dbLocalPosContent = cartUsualString(cart, dbPosKey, NULL); if (dbLocalPosContent) { if (strchr(dbLocalPosContent, '=')) { gotCart = TRUE; cartParseOverHash(lastDbPosCart, cloneString(dbLocalPosContent)); // this function chews up input position = cloneString(cartUsualString(lastDbPosCart, "position", NULL)); } else { position = dbLocalPosContent; // old style value } }