Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2011 at 09:14 UTC
Updated:
8 Mar 2017 at 16:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
craigmc commentedAlso having an issue with edit link with AJAX enabled-- adds 22k character string to destination that causes error with my web server.
URL;
Comment #2
dawehnerIn theory the field handler would have to use something like $view->get_path() instead of drupal_get_destination().
I'm not sure whether this might open other bugs.
Comment #3
Anonymous (not verified) commentedI'm having the same issue with 6.x-2.12. I've created a dashboard of sorts for admin's to keep on top of new content, and have several views in quicktabs. All the views are ajax enabled for nice pagination, but the link to edit the view sets the destination to views/ajax. When the user's use the link to edit a node, after hitting save they just get some json content on a blank screen.
Comment #4
dawehnerPerhaps this patch helps you: http://drupal.org/node/956186 but it was created based on a views issue.
Comment #5
iamjon commentedClosing from a lack of activity.
Comment #6
apmsooner commentedI'm reopening this issue because it persists and can't imagine works as designed. The edit path for ajax enabled view is: destination=views/ajax which makes page try to open an ajax file upon saving the record. Was there some sort of patch for this or a fix in the dev version?
Comment #7
dawehnerDoes someone know whether there is an easy way to get the original url in an ajax request?
Comment #8
geerlingguy commentedSubscribe, and to dereine, I'm not sure. This bug only affects one admin facing page on my site, so it's not a huge issue for me, but it would be fine with me if no destination was set at all, for my purposes.
Comment #9
josebrito commentedI subscribe this post because I have the same problem.
I'd like to know how to get the original url to rewrite the "Edit" link.
Comment #10
Toongenius commentedSame issue. Subscribing
Comment #11
das-peter commentedSame issue here - it's somewhat annoying if you use admin_views and saving a node sends you an ajax output :D
The idea I've had was to ensure
drupal_get_destination()sends an appropriate destination. To do so I inject a custom value into the static cache of the function inviews_ajax().I'm not sure if this approach has nasty side-effects - at least it seems to work in my vbo case.
Comment #12
dawehnerThis patch looks fine. Committed to 7.x-3.x and maybe needs a backport
Comment #13
das-peter commentedAwesome thanks!
Comment #14
timofey commentedI am still having the same issue.
After using Ajax to sort columns, my links look like this:
destination should end at "content/aaa"
I'm using the 7.x-3.3 (2012-Feb-22 release). I can also see that it's patched with #11.... but it's not working.
Comment #15
dawehnerLet's move the issue back as your comment is quite unrelated.
You seems to have enabled session ID via URL, i'm pretty sure this a wrong server configuration.
Additional this issue is only about edit links of nodes...
Comment #16
ddrozdik commentedSame issue happens when I use filters(views 7.x-3.3).
Link looks as
http://mysite.com/node/1073/edit?destination=admin/dashboard/content%3Fq%3Dviews/ajax%26nid%3D%26type%5B0%5D%3Dnews%26title%3D%26status%3D0%26premium%3DAll%26uid%3D%26date_filter%5Bmin%5D%5Bdate%5D%3D%26date_filter%5Bmax%5D%5Bdate%5D%3DOn my local machine works fine but on dev server doesn't work.(strange)
Comment #17
ddrozdik commentedProblem was in config of ngnix, need to correct configure mod_rewrite for sites on drupal 7, because they have some differences from drupal 6.
Comment #18
dazz commentedand what is this correct configuration?
Comment #19
acbramley commentedGetting this problem too on Views 7.x-3.3 with an admin page of users with exposed filters and edit links. After clicking the edit link on a filtered page, editing a user, and clicking save, I'm redirected to /views/ajax?field_user_fname_value=Adam&field_user_lname_value=&status=All&rid=All&field_access_control_tid=All
Comment #20
mojiro commentedI also use nginx. Could you please post your new configuration ?
Comment #21
mustanggb commentedChanging #11 to following fixed it for me (CNW because I haven't rolled a patch):
Comment #22
acbramley commented#11 didn't fix the issue for me, #21 did though :) thanks a lot
Comment #23
acbramley commentedHere's a patch rolled off 7.x-3.x from the changes in #21
Comment #24
acbramley commentedAh the problem here is though when you return to the destination with the query parameters, ajax filtering/sorting etc no longer works
Comment #25
grahamcThe filtering isn't working because the$_GET += $_POST;line does not overwrite existing keys in $_GET with the new $_POST values.
Change that to$_GET = array_merge($_GET, $_POST);and it works again.edit: Oh, nevermind, that's already fixed if you're using the current release of Views.
(I'm wondering whether query parameters should even be necessary if the user has an active $_SESSION...? - Views saves/loads status of the filters there anyway.)
Comment #26
mr.york commentedThe filtering isn't working because the $_GET += $_POST;
I removed this modification.
Comment #27
mr.york commentedComment #29
grahamcSo, _another_ attempt at creating a patch from #21 then...
Comment #30
Funksmaname commentedThank you! This patch seems to have fixed the nasty error I was getting in views with ajax enabled...
Comment #31
seanbfuller commentedThis patch worked great to fix the critical issue for us of hitting the ajax page after editing a node. We did find one minor nit that came out of it, however: If you are paginated in beyond the first page of results, you get a page=x argument in the url when you come back after editing. This makes it impossible to get to back to the first page using the pager. Looks like this is because the url value overrides the non-existent value in the pagination link.
Steps to reproduce:
Again, I'm not sure that this minor item is worth holding up the larger fix. This also might be more of an issue with pagination. A "page=0" parameter on the link would fix this. Not sure if that's worth splitting out to a new issue. Beyond that, the patch worked and fixed the critical issue so thanks.
Comment #32
mstef commentedPatch #23&29 do not resolve the issue for me.
This is the link to the edit form after submitting the filter via AJAX: http://localhost/node/23/edit?destination=admin/workbench/content/my%3Ft...
After submitting, I'm redirected to: http://localhost/admin/workbench/content/my?title=6timestamp%5Bmin%5D%3D...
Which is incorrect because now title=(the entire remaining URL), so it all gets sent into the title filter.
Comment #33
mstef commentedPerhaps that's a separate issue entirely?
Comment #34
mstef commentedSorry, it appears my bug is unrelated. Forgot what I said..
Comment #35
mxwright commentedThanks! This seems to fix a long-outstanding issue for us.
Comment #36
rogerrogers commentedJust wanted to chime in that this patch works for us. We have had to use on multiple sites. Will this get included in the main branch?
Comment #37
john bickar commentedTested the patch in #29 and it resolves the issue for me.
Comment #38
jlporter commented#29 fixed our issue which was in the views_admin module, applied to 3.7 cleanly with a patch -p1 (got something weird with p0).
related admin_views issue that was fixed by this patch: https://drupal.org/node/1650420
Comment #39
merilainen commented#29 worked for us also, not using views_admin. Experienced it only on our development server, which is Nginx. Local apache environments didn't have any problems. I know, they should be identical, but life is life :)
Comment #40
westie commented#29 worked for me, again on nginx. Please can this be committed?
Comment #41
torpy commentedChiming in with another "it works for me!", this time on IIS 7.5 and IIS 8.
Comment #42
moonray commented#29 worked to fix the problem on Pantheon (nginx server).
Like #39 said, local apache based environment isn't affected by this bug.
#31 indicated there is still a small problem that needs to be solved, but we should probably try to fix that in a follow-up patch since the critical issue is solved by the patch in #29.
Comment #43
mustanggb commentedAlthough I'm the original "patch" creator I recently applied this to a new site and it's still working fine.
Bumping to major for a bit of attention and it's quite an important fix for people using the AJAX feature.
Comment #44
dawehnerIt would be great to merge some of the comments and move this to the issue summary. This helps people to understand what is going on.
One requirement about the patch: Could we add some comment why we exactly need to unset $query['q']?
Comment #45
enzipher commentedDoes the issue mentioned in #31 get any love here? If not it would be better to put that one as a separate issue.
Comment #46
seanrI agree with #45 - please at least get this into views since it's working for folks, then we can address that one separately (unless someone's got a patch that fixes #31 now too).
Comment #47
CLEE25 commentedAdd me to the group of people who finally found a fix with #29. This was a problem across many sites, and was incredibly annoying since it never seemed to happen all the time. Only when I was demo-ing for clients.
#29 fixed it like a dream.
Comment #48
arosboro commentedCan anyone else confirm that patch 29 does not introduce issues with bulk operations? I am finding that when I try to delete multiple pieces of content that the page just refreshes with no action taken.
Comment #49
arosboro commentedI did some more testing. Caching was enabled which was causing the problems that I experienced. That is "works as designed" as far as I am concerned. I believe #29 successfully remedies 'views/ajax' being included in the destination parameter.
Comment #50
gmclelland commentedThe patch in #29 worked for me. In my case after I clicked the "Edit" link at admin/content/file and then edited and saved the file, I would be shown a bunch of json.
After patching with #29 on the latest Views module, editing files works as expected.
Comment #51
mustanggb commentedAny chance to get this committed?
Comment #52
aaronbauman#29 RTBC++
Comment #53
jdcollier commentedImpertinent question ...
It seems this isn't in the dev or stable branches still. Is this due to a [very] understandable workload issue on the dev team, or is there a concern with this patch that I'm not seeing?
Every time I install this patch, then a Views security update comes out and wipes it out :(
I appreciate the work ... I'm honestly wondering if I'm missing something on this one.
Thank you so much!
JD
Comment #54
davej commented#29 resolved the problem here, with Views 7.x-3.8 under nginx.
Without the patch, the edit link URL from Views URL /group was:
/node/672/edit?destination=og%3Fq%3Dviews/ajax%26field_group_type_value%3DAll%26page%3D1
which, after saving the node, resolved to:
/views/ajax?field_group_type_value=All&page=1
which presented the user with some JSON.
With the patch, the edit link URL from Views URL /group is:
/node/672/edit?destination=og%3Ffield_group_type_value%3DAll%26page%3D1
which, after saving the node, resolved to:
/group?field_group_type_value=All&page=1
I agree with #31 that there is an issue with pagination after returning from the edit, also agree that this is a minor issue compared to the main issue.
Cheers,
Dave
Comment #55
djschoone commented#29 works for me too! Thnx.
Comment #56
westberliner commentedGot an similar Issue with admin_views and nginx. #29 solved this.
Comment #57
dafeder#29 worked for me on pantheon. Commit it!
Comment #58
lukusThis is working for me also.
Any idea when this will be committed?
Thanks
L
Comment #59
jkingsnorth commentedDuplicate issue here: #2188829: Error when creating new user if the user listing has more then one page - the RTBC patch in #29 also fixes that, so it would be great to get this in Views as it is obviously still a problem!
Comment #60
jkingsnorth commentedThe 'broken pager' issue described in #31 and since is actually a separate issue that is being worked on here: #1786524: AJAX pager does not work if page number set in URL - so I don't think it should impede the progress of this patch.
Comment #61
labboy0276 commentedThank You, I can confirm #29 works as well. This problem has been around for so long, I just became accustomed to it....
Comment #62
parisekI can confirm too that #29 patch worked and problem solved. Patch is ready for 2 years why is not committed?
Comment #64
wiifmSo this is a major issue, and it is effecting a major module in admin_views (with 54k installs and counting).
Steps to reproduce:
/admin/contentExpected behavior:
Returned to the content admin screen with the sort maintained, and a message saying 'saved'
Actual behavior:
Sent instead to
/views/ajax/and JSON is presented on the screen confusing all content authors.Example edit link (before patch):
Note the
q=views/ajaxin the destination:/node/19/edit?destination=admin/content%3Fq%3Dviews/ajax%26type%3Dtlms_partner%26status%3DAll%26vid%3DAll%26order%3Dtitle%26sort%3DascExample edit link (after patch):
Patch at #29 fixes this (running against views 3.x), and looks like it has for everyone else here. Intrigued as to why this has not got the maintainers attention by now?
RTBC +1
Comment #65
wiifmHad a discussion with @dawehner on IRC, Daniel suggested to improve the documentation of the patch as to why it is actively unsetting $_GET['q'].
Attached is a new patch that does this (no code changes).
Comment #66
ChrisFlink commentedTested the latest patch by wiifm on the latest dev version of views. Comment makes sense. Patch seems to work fine and the issue when json is displayed instead of a page is gone. Since the last change to the patch only updated the comment and patch in #29 was successfully tested too, I'd say commit asap because this is a major issue with a solution laying around for over two years.
Comment #67
acbramley commentedConfirming this only seems to be an issue on Nginx configurations, using a local apache instance I couldn't reproduce the problem but could on our staging site running on nginx. After applying the patch the issue was fixed!
Comment #68
fabianx commentedWhy are we using $_REQUEST when just above we set $_GET to be $_POST and $_GET.
If we want the original vars without what was posted, we need to save the var before the
$_GET = $_GET + $_POST
If we want the combination of $_GET and $_POST, we can directly use $_GET in the first place as we just combined them ourselves.
I believe this wants to have the original $_GET instead ...
UPDATE:
It seems this wants to replace drupal_get_destination(), which is statically cached.
That is okay, but it should probably use the same functions:
- https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...
Comment #69
douggreen commentedGiven how long this took to get committed (and it does look like it's committed), I'd suggest a simpler change, which is just to use $_GET instead of $_REQUEST.
The problem with using $_REQUEST is that it can contain cookie data (see http://php.net/manual/en/reserved.variables.request.php and http://php.net/request_order), depending on the php ini configuration. And cookie data with httponly set (see http://php.net/setcookie) should never leave the server.
Comment #70
fabianx commentedI don't think this is committed, yet.
And I think using proper APIs is important to avoid such problems.
And I still believe the destination URL should be created before $_GET is merged with $_POST.
Comment #71
dsnopekI can also confirm that this issue occurs under nginx but not Apache. Does anyone know why? I really can't imagine how differences in webservers could cause this. But I know next to nothing about nginx, so that might be why I don't get it.
Anyway, I agree with @Fabianx in #68 that using the same APIs as in
drupal_get_destination()which is being inlined here makes sense. This basically means switching from$_REQUESTtodrupal_get_query_parameters()which has the magic property of skipping$_GET['q'].So, here is a much shorter patch that both (a) fixes this problem for me under nginx and (b) makes the Views code closer to the code it's inlining.
Please let me know what you think!
Comment #72
brandy.brown commented#71 worked for me. Thank you!
Comment #73
katannshaw commentedPatch #71 worked for me as well. Thanks.
Comment #74
istryker commentedHaven't tested, but that patch looks better. Calling the Drupal function to get the parameters vs getting them directly.
2 people said it worked, RTBC issue
Comment #75
xurizaemonHere's hoping it gets into the next Views update I guess :S
RTBC++ from me too.
Comment #76
Anonymous (not verified) commentedI just stumbled upon this bug in Pantheon and #29 fixed it for me.
Comment #77
dsnopek@ivanjaros: could you try the patch in #71 and see if that works for you too?
Comment #78
lunk rat commented#71 fixes it for me on BOA 2.4.4 with PHP 5.5.21, Nginx 1.7.9.1
Incidentally I am also creating a dashboard that uses AJAX-enabled views within a Seven overlay to provide edit links to content. This patch fixed my issue.
Comment #79
areynolds commented#71 works beautifully in an nginx environment (tested both in Kalabox and Pantheon).
Also, might I add @dsnopek has impeccable patch labeling etiquette.
Comment #80
vadym.kononenko commented#71 works for me.
Comment #81
simon georges commented#71 fixed it for me on IIS 7.5. Great work everybody! Let's commit this ;-)
Comment #82
simon georges commentedComment #83
FutureFirstDave commentedYup, #71 works for me too.
Comment #84
socialnicheguru commentedWill this fix in #71 work on apache or break its functionality while fixing nginx?
Comment #85
fabianx commentedRTBC +1
Comment #86
dsnopek@SocialNicheGuru: This fix doesn't break anything on Apache - everything continues to work fine there.
Comment #87
hanoii@dsnopek just found this issue on panopoly on pantheon and remember about a this patch which I used to use in serveral of my sites, but now it has a patch from you, any chance to include the patch in panopoly as well: #2468989: Include views patch to fix destination query string on ajax calls from views ?
Comment #88
gmclelland commentedThe patch in #71 works for me using NGINX on Pantheon
Comment #89
ChrisFlink commentedPatch #71 works for me too, and is RTBC but was not included in 7.x-3.11 release.
I wonder why?
Comment #90
mustanggb commentedSuch a simple and elegant solution, let's have it!
RTBC++
Comment #91
lunk rat commentedThis patch works great for my sites.
Every time Views gets a security release I start seeing people commenting "RTBC++" on patches that are ready because we all have to patch after installing the security release ;) ... let's drop this one off of the list of things to remember to do when we update our sites!
Comment #92
rogerrogers commented@lunk_rat For real. It works. It has worked for years. Include it and be done with it.
Comment #93
fabianx commentedI think priority major is correct.
Comment #94
meaton commentedI can also confirm that this patch works well on Pantheon/NGINX.
Comment #95
dawehnerI totally agree that $_REQUEST contains too many information. We already merge into $_GET, so using that as part of drupal_get_query_parameters() should be fine.
Ups, I committed that as part of d08465de955b88e5f262c06d99b79ceb167dca88 already when trying things out locally, anyway,
git --allow-emptyhelped in that case. Committed that empty message and pushed to 7.x-3.xComment #98
sushantpasteThanks for the patch :)
Comment #99
Solthun commentedI can confirm that this patch worked on an environment with nginx and also on Azure hosting with IIS.
Thanks for the patch!
Comment #100
betoaveiga(I know it's old, but it could help somebody searching the same like I did)
To fix this problem you can create/modify your module hook_init like this:
It works for me.
Comment #101
michaeljhill commentedI'm having this issue while using the Jump Menu format of Views. I need AJAX to be enabled so that I can see my exposed filter in the view's block. Instead of getting sent to the expected address, I get directed to "document-root/views/ajax" when AJAX is turned on. I've tried the patches on this thread but they have not made a difference. I see several people saying this issue is only occurring on nginx, however I'm having this problem with apache being my web server.
Running:
Drupal 7.53
Views 7.x-3.15