Repository: jenkinsci/jenkins
File: core/src/main/resources/lib/hudson/progressive-text.js (JavaScript)

Code before:
        }
        if (rsp.status === 403) {
          // likely an expired crumb
          location.reload();
          return;
        }
        var stickToBottom = scroller.isSticking();
        if (rsp.status >= 400) {
          var p = document.createElement("DIV");
          e.appendChild(p);
          p.innerHTML = '<br/><div class="error">' + errorMessage + "</div>";
          if (stickToBottom) {
            scroller.scrollToBottom();
          }
          if (spinner !== "") {
            document.getElementById(spinner).style.display = "none";
          }
          return;
        }
        var parse;
        if (
          rsp.headers.get("Content-Type")?.startsWith("multipart/form-data")
        ) {
          parse = rsp.formData().then((data) => {
            var text = data.get("text");
            var meta = JSON.parse(data.get("meta"));
            return Object.assign({ text }, meta);
          });
        } else {
          parse = rsp.text().then((text) => {
            return {
              text,
              end: rsp.headers.get("X-Text-Size"),
              consoleAnnotator: rsp.headers.get("X-ConsoleAnnotator"),
              completed: rsp.headers.get("X-More-Data") !== "true",
            };
          });
        }
        /* append text and do autoscroll if applicable */
        parse.then(({ text, end, consoleAnnotator, completed }) => {
          e.fetchedBytes = end;
          e.consoleAnnotator = consoleAnnotator;
          if (text !== "") {
            var p = document.createElement("DIV");
            e.appendChild(p); // Needs to be first for IE
            p.innerHTML = text;
            Behaviour.applySubtree(p);
            if (stickToBottom) {
              scroller.scrollToBottom();
            }
          }

Review comment (suggestion):
```suggestion
            const text = data.get("text");
            const meta = JSON.parse(data.get("meta"));
```

Code after:
        }
        if (rsp.status === 403) {
          // likely an expired crumb
          location.reload();
          return;
        }
        var stickToBottom = scroller.isSticking();
        if (rsp.status >= 400) {
          var p = document.createElement("DIV");
          e.appendChild(p);
          p.innerHTML = '<br/><div class="error">' + errorMessage + "</div>";
          if (stickToBottom) {
            scroller.scrollToBottom();
          }
          if (spinner !== "") {
            document.getElementById(spinner).style.display = "none";
          }
          return;
        }
        let parse;
        if (
          rsp.headers.get("Content-Type")?.startsWith("multipart/form-data")
        ) {
          parse = rsp.formData().then((data) => {
            const text = data.get("text");
            const meta = JSON.parse(data.get("meta"));
            return { text, ...meta };
          });
        } else {
          parse = rsp.text().then((text) => {
            return {
              text,
              end: rsp.headers.get("X-Text-Size"),
              consoleAnnotator: rsp.headers.get("X-ConsoleAnnotator"),
              completed: rsp.headers.get("X-More-Data") !== "true",
            };
          });
        }
        /* append text and do autoscroll if applicable */
        parse.then(({ text, end, consoleAnnotator, completed }) => {
          e.fetchedBytes = end;
          e.consoleAnnotator = consoleAnnotator;
          if (text !== "") {
            var p = document.createElement("DIV");
            e.appendChild(p); // Needs to be first for IE
            p.innerHTML = text;
            Behaviour.applySubtree(p);
            if (stickToBottom) {
              scroller.scrollToBottom();
            }
          }