Skip to content

post payload truncated if it contains an and symbol #37

Open

Description

@laserfox

example:

params = { 'content' : {
'Subject' : 'Janet & John',
'Text' : 'hello all,
}
}

the Subject in params is truncated and RT only receives the 'Janet'

Activity

  1. heresandyboy commented on Feb 25, 2014

    @heresandyboy

    I'll try this when I get home, but does the ampersand need to be encoded, URL encoding would be "%26" or html encoded with "&" without the quotes obviously. I'll do some testing in the next hour and get back to you.

  2. heresandyboy commented on Feb 25, 2014

    @heresandyboy

    Hmm the coments box changed my html encoded ampersand back to &, so its " & amp ; " without the spaces. But I bet you knew that already.

  3. laserfox commented on Feb 25, 2014

    @laserfox
    Author

    Not sure if it is related, or similar, but z4r closed a similar issue 3
    months ago here:

    #34

    this was concerning content that contained a semicolon rather than an
    and symbol

    On 25/02/14 18:30, heresandyboy wrote:

    Hmm the coments box changed my html encoded ampersand back to &, so its " & amp ; " without the spaces. But I bet you knew that already.


    Reply to this email directly or view it on GitHub:
    #37 (comment)

  4. heresandyboy commented on Feb 26, 2014

    @heresandyboy

    Sorry it took so long to get around to this.
    I tested HTML encoding the ampersand and still experienced truncating in the subject, but not in the body strangely. I discovered that URL Encoding the '&' as %26 resulted in the correct subject being set.
    Like so:

    params = {
    'content': {
    'Queue': 'Test Queue' ,
    'Subject': 'Janet %26 John',
    'Text': 'Hello all.',
    }
    }

    That resulted in a new ticket with 'Janet & John as the subject.
    So its clear the subject payload needs to be URL Encoded, having a look at the issue you mentioned above, this should have been covered by the use of urllib.quote in forms.py
    I had a go at fixing it but not quite there yet, and its bed time, I'll be happy to take a look tomorrow.

    In the mean time, you can do the following to work around the problem:

    params = {
    'content': {
    'Queue': 'Test Queue' ,
    'Subject': urllib.quote('Janet & John'),
    'Text': 'Hello all.',
    }
    }

    Results in a new ticket with 'Janet & John' as the subject and no truncating.
    :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions