backdrop-contrib / tugboat

Integrates with Tugboat.qa to allow creating on-the-fly preview sites.
GNU General Public License v2.0
0 stars 1 forks source link

Redirect is not working after creating sandbox #11

Closed quicksketch closed 4 years ago

quicksketch commented 4 years ago

After creating a sandbox, the AJAX handler is not redirecting properly. ajax_command_redirect() requires a full URL, like /demo/foo, but it's being passed a relative one like demo/foo. This results in redirecting to a URL like /demo/demo/foo if you're already on the /demo page.

  if (isset($form_state['redirect'])) {
    $commands[] = ajax_command_redirect($form_state['redirect']);
  }

Should be

  if (isset($form_state['redirect'])) {
    $commands[] = ajax_command_redirect(url($form_state['redirect']));
  }
ghost commented 4 years ago

@quicksketch Are you referring to BackdropCMS.org? I'm not experiencing this... I get redirected fine from https://backdropcms.org/demo to https://backdropcms.org/demo/5ebd863e57d91a38ec4b64be. Can you provide STR?

ghost commented 4 years ago

Ah nevermind, just experienced this on B.org. Weird how I've never seen it happen there before now...

ghost commented 4 years ago

PR here: https://github.com/backdrop-contrib/tugboat/pull/12

@quicksketch Since it's just the code addition you posted above, I'm tempted to just commit it, but I'll leave it a few days in case you want to review it first.

ghost commented 4 years ago

Committed, thanks @quicksketch!

ghost commented 4 years ago

I also updated the Tugboat module on B.org: https://github.com/backdrop-ops/backdropcms.org/pull/685 so this fix is included there now.