Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-26660

JSON.parse: unexpected character

    XMLWordPrintable

Details

    Description

      When we create any bug, we got an Javascript error:
      JSON.parse: unexpected character

      After some investigation, we realised, that problem was in jira-dnd-attachment.js file on line 253:

                  AJS.$.get(contextPath + "/rest/jira-dnd-attachment/1.0/issue/attachments/limits", function(data)
                  {
                      var limits = JSON.parse(data);  // Error is here
                      if (limits !== "undefined" && limits.maxSize !== "undefined")
                      {
                          dndAttachment.attachmentSizeLimit = parseInt(limits.maxSize);
                      }
                  });
      

      When we replaced that string to var limits = data; error gone.
      I suppose, that JQuery's get method by default uses Intelligent Guess, and automagically converts data to json. So additional convert is not possible.
      Hope, you can fix it quickly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            g.chernyshev Grigory Chernyshev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: