Opened 4 years ago

Closed 4 years ago

#1485873 closed Bugs (worksforme)

poossible bug in app.js

Reported by: corbosman Owned by:
Priority: 5 Milestone: 0.3-stable
Component: User Interface Version: git-master
Severity: normal Keywords:
Cc:

Description

In app.js, function http_post, there's the following code:

jQuery.post(url, postdata, function(data){ ref.http_response(data); }, 'json');

This is probably a relatively recent move to jquery. But postdata is just a simple string like: '_remote=1&unlock=1', or in my case, im adding some plugin data to be posted: '_address=test+test at test.com&_remote=1' (im replacing the at sign with the word at to prevent the system from cutting it off)

On the server side, this is ending up like:

Array
(

[_address] => test test at test.com

[_remote] => 1

)

As you can see, the + is replaced by a space. I did a bit of debugging, and noticed that the jQuery.post call seems to be wrong. The second parameter should not be a string like that, but should be done like:

jQuery.post(url, { address : "test+test at test.com" , remote : "1" } .... );

When you do it that way, the server side is correct:

Array
(

[_address] => test+test at test.com

[_remote] => 1

)

See: http://docs.jquery.com/Ajax/jQuery.post

Change History (1)

comment:1 Changed 4 years ago by alec

  • Resolution set to worksforme
  • Status changed from new to closed

I think you should just use urlencode on address.

Note: See TracTickets for help on using tickets.