Author Topic: Roundcube 1.1.0 appending duplicate querystring vars [SOLVED]  (Read 3427 times)

Offline bit_jockey

  • Newbie
  • *
  • Posts: 2
Hello,

  I just updated to 1.1.0 and it immediately broke a plugin I wrote.  This plugin has been working fine with prior releases tested up to 1.0.5.

My plugin adds a button to the top taskbar.  When clicked, the plugin makes an ajax call to fetch the page contents.  Nothing special.  However, I am seeing logfile entries like this:

Quote
[18-Mar-2015 15:53:36 -0700]: <ghaptvr2> PHP Error: No handler found for action plugin.request_ajax in /usr/share/roundcubemail/program/lib/Roundcube/rcube_plugin_api.php on line 463 (POST /?_task=quarantine&_action=plugin.request_ajax?_task=&_action=)

Please note the duplicate _task and _action querystring variable.

Again, this plugin has been working fine, tested through 1.0.5.  Here are some code snippets

Code: [Select]
/* CLASS FILE */
# Only Register Actions if we have chosen Quarantine from the Taskbar
    if( $this->rcmail->task == 'quarantine' ) {
      $this->register_action( 'plugin.request_ajax', array( $this, 'request_handler' ) );
    }

function register_icon() {
    # Load Icon Stylesheet
    $this->include_stylesheet( 'styles/amacube_remix_quarantine.icon.css' );

    # Add Quarantine Icon to the Taskbar
    $this->add_button( array(
      'command'    => 'quarantine',
      'class'      => 'button-quarantine',
      'classsel'   => 'button-quarantine button-selected',
      'innerclass' => 'button-inner',
      'label'      => 'quarantine',
      'domain'     => 'amacube_remix_quarantine'
    ), 'taskbar' );
  }

Code: [Select]
/* JAVASCRIPT */
// Register Event Listeners
        rcmail.addEventListener( 'plugin.response_messagelist', response_messagelist );

        rcmail.addEventListener( 'init', function( evt ) {
                // Populate Quarantine Table
                rcmail.http_post( 'plugin.request_ajax', { action: 'show_quarantine', settings: settings } );
        });


As you can see from the code, I am only registering the plugin.request_handler action when the task variable is set to quarantine.  However, since the URL began appending an additional *empty* _task var, the action is never registered.

Help? :)
« Last Edit: March 19, 2015, 01:08:46 PM by bit_jockey »

Offline bit_jockey

  • Newbie
  • *
  • Posts: 2
Re: Roundcube 1.1.0 appending duplicate querystring vars
« Reply #1 on: March 19, 2015, 01:08:27 PM »
I solved this problem by modifying my plugin.

In the class file as well as the javascript, any instance I had of 'plugin.request_ajax' was shortened to simply 'request_ajax'.

It's a bit nebulous as the plugin docwiki, under the section "Ajax requests and callbacks" provides an example using the magic plugin. prefix.  And whats even more strange, my plugin was working fine on previous versions of Roundcube.

Here's a link to the docwiki for reference:
http://trac.roundcube.net/wiki/Doc_Plugins