=)

CommentFileSizeAuthor
globalredirect.patch2.27 KBrobertDouglass
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

robertDouglass’s picture

I wanted to avoid the second call to drupal_goto in line 42 but didn't figure out an elegant way to do so.

nicholasThompson’s picture

Nice patch - I like the idea... Thoughts:
* That patch only causes a lookup for node/123 and not node/123/ - will there ever be a situation where the src WITH slash will be mapped to a destination but NOT the source WITHOUT slash?
* I cant see a much neater way of doing that last two drupal_goto's...

I personally cant see any issue with only doing a no-slash lookup on the source, so I am all for commiting this to the project.

Cheers Rob!

Nick

robertDouglass’s picture

I'm personally not worried at all about not doing a lookup on node/123/. If anyone can think of a case where that is relevant, I'm open to hearing it, but it sounds more like a case where we'd be accommodating something that's broken.

m3avrck’s picture

Patch looks great but I have one suggestion:

+    $query_string = drupal_query_string_encode($_GET, array('q'));
+    if (empty($query_string)) {

Couldn't this merely be:

if (empty($_GET['q']) {

That would be a whole lot faster, eh?

nicholasThompson’s picture

Faster, yes. But that function does a fair bit of work.

As I understand it, it checks for arguments other than the 'q' one (for example, page, destination, etc). Without this, users cannot login on the frontpage as it breaks the destination query parameter (eg, node/123?destination=node/124 wouldn't resolve to articles/thingy.html?destination=node/124 as it should. It would lose the destination argument).

robertDouglass’s picture

Status: Needs review » Reviewed & tested by the community

RTBC?

m3avrck’s picture

Hmm, yes I see your point. Wondering if something could be refactored somewhere to just look at $_GET[] as a whole, hmm... anyways this patch is a start of something great :-)

nicholasThompson’s picture

Assigned: Unassigned » nicholasThompson
Status: Reviewed & tested by the community » Fixed

Patch applied and backported to 4.7. Thanks for your work on this Rob!

killes@www.drop.org’s picture

Status: Fixed » Closed (fixed)