There is a problem with the JavaScript URL redirect when the Drupal site is installed in a subdirectory. The JavaScript uses 'window.location.pathname' which does not account for a subdirectory that Drupal may be installed in. The attached patch uses 'Drupal.settings.basePath' to get the base install directory. It compares the pathname to see if the basePath begins with it. This should always return TRUE since the default basePath for none subdirectory installs will be '/'. It then trims off the subdirectory and if there is any path left it appends it as a URL query 'destination'.

So if the Drupal install is at the root of the server and login is on homepage :
basePath = '/';
pathname = '/';
destination = ''
so no destination is appended to query string

If Drupal install is in '/mydir' and login is on homepage then:
basepath = '/mydir'
pathname = '/mydir'
destination = ''
so no destination is appended to query string

If login is from 'somepage' and Drupal installed in root:
basepath = '/'
pathname = '/somepage'
destination = 'somepage'

If login is from 'somepage' and Drupal installed in '/mydir':
basepath = '/mydir/'
pathname = '/mydir/somepage'
destination = 'somepage'

So everything ends up redirecting correctly.

CommentFileSizeAuthor
#1 colorbox_subdirectory_1413768_1.patch737 bytestinker
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tinker’s picture

Attached patch

tinker’s picture

Priority: Critical » Major

Am I the only one that has multiple web sites installed in subdirectories on a hosting account? Thought this was a critical issue but I guess not. Moving down to 'Major'.

frjo’s picture

Status: Needs review » Closed (won't fix)

The attempt to support opening various forms in a Colorbox was in hindsight never a good idea. Form error handling and form redirects are complicated, a lot of code would be needed to do it correctly. The 7.x-2.x branch removes the form support from the Colorbox module.