message: When downloading, try to consume the data as mush as possible before tripping over illegal chars.
  issue
diff: @@ -144,18 +144,18 @@ class DownloadSession {
  this._encodedDataBuffer += encodedData;
  + let splitIndex = this._determineBufferSplitPosition();
  + while (splitIndex !== -1) {
  + const chunk = this._encodedDataBuffer.slice(0, splitIndex);
  +
  // Check for invalid characters which may indicate a crash on the remote side.
  - if (invalidBodyRegex.test(this._encodedDataBuffer)) {
  - this._log.warn("Data buffer contains illegal characters. Aborting.");
  + if (invalidBodyRegex.test(chunk)) {
  + this._log.warn("Chunk contains illegal characters. Aborting.");
  this._state = DownloadHandlerState.ERROR;
  this._closeFileHandle(false);
  return {action: TermApi.ApplicationModeResponseAction.ABORT, remainingData: this._encodedDataBuffer};
  }
  - let splitIndex = this._determineBufferSplitPosition();
  - while (splitIndex !== -1) {
  -
  - const chunk = this._encodedDataBuffer.slice(0, splitIndex);
  const tail = this._encodedDataBuffer.slice(splitIndex);
  if (tail.startsWith("\n") || tail.startsWith("\r")) {
  this._encodedDataBuffer = tail.slice(1);
  