Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve Jones 36 posts 84 karma points
    Dec 10, 2015 @ 19:02
    Steve Jones
    0

    Unexpected end of multiparty form - json - postsave

    We are attempting to use the back office api postsave json.

    Whenever we attempt it we get a 500 error. We have tried changing the mime type, charset adding \r\n to the params but with no luck.

    The json blob that is used in the grid in 7 has json in a content field and this gets pretty messy we have noticed. We have also noticed that the getbyid method has some malformed json too.

    Are there any known defects or others with the same issue?

    We created a cap file for Wireshark and managed to get a better error, see below.

    "unexpected end of mime multipart stream )]}', \n"

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Dec 10, 2015 @ 20:32
    Nicholas Westby
    0

    The characters )]}', at the beginning of a response is a feature of Umbraco/AngularJS to avoid JSON hijacking:

    https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection

    Can you post the code that you are using?

    (Side note: I'm having issues with the above link, it seems because of the dollar sign in it.)

  • Steve Jones 36 posts 84 karma points
    Dec 11, 2015 @ 05:06
    Steve Jones
    0

    Hi Nicholas

    Thanks for the quick reply. Is there a reason then that angular or Umbraco isn't stripping out the character's?

    The code I have works for post login and a content get but not a save.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Dec 11, 2015 @ 05:41
    Nicholas Westby
    0

    What makes you think Angular isn't stripping out the characters?

    Also, it's very hard to know what might be wrong without seeing some of the code you are using.

  • Steve Jones 36 posts 84 karma points
    Dec 11, 2015 @ 07:51
    Steve Jones
    0

    The article you referenced suggests that Angular will strip out the extra characters as it knows they are there for security.

    The 500 error occurs and the error message I have is the one I posted.

    It is a java integration with a 3rd party application we are helping with. I can't post all of the code.

    This is an example of the JSON we are sending, as you can see the value property contains JSON and this is attempted to be escaped.

    ------WebKitFormBoundarych03Lqa2pHVQFcOX

    Content-Disposition: form-data; name="contentItem"

    {"id":1073,"properties":[{"id":59,"alias":"content","value":"{\"name\":\"1 column layout\",

  • Steve Jones 36 posts 84 karma points
    Dec 11, 2015 @ 23:47
    Steve Jones
    0

    Here is the extra information I found from Wireshark

    {"Message":"An error has occurred.","ExceptionMessage":"Unexpected end of MIME multipart stream. MIME multipart message is not complete.","ExceptionType":"System.IO.IOException","StackTrace":" at System.Net.Http.Formatting.Parsers.MimeMultipartBodyPartParser.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Dec 12, 2015 @ 06:18
    Nicholas Westby
    0

    What URL are you posting the request to?

  • Steve Jones 36 posts 84 karma points
    Dec 14, 2015 @ 07:04
    Steve Jones
    0

    /umbraco/backoffice/UmbracoApi/Content/PostSave

    I have tried fixes that have worked for others with the same issue, there was even a similar defect logged with Umbraco.

    I have tried the permissions on the folders Setting Load User Profile to true in IIS The JSON I am sending back has been validated using JSON Lint

    Maybe there is an update to version 7 that contains a fix that I am missing.

  • Steve Jones 36 posts 84 karma points
    Jun 01, 2016 @ 06:53
    Steve Jones
    0

    This has been fixed by removing the hyphens from the header declaration and having 2 hyphens in the JSON payload boundary declaration.

Please Sign in or register to post replies

Write your reply to:

Draft