Skip to content

creating a text attribute with very large initial content will trigger a payload too large response. #101

@wolfoo2931

Description

@wolfoo2931

it can be uploaded in parts like this


function splitByLength(str: string, maxLength: number): string[] {
  const parts = [];
  for (let i = 0; i < str.length; i += maxLength) {
    parts.push(str.slice(i, i + maxLength));
  }
  return parts;
}

......


const MAX_TEXT_CONTENT_LENGTH = 5000;
const textContentParts = splitByLength(fileContent, MAX_TEXT_CONTENT_LENGTH);
let textContentPatched = textContentParts.shift() || '';
fileContentAttribute = await this.lr.Attribute.createLongText(textContentPatched, facts);

while(textContentParts.length > 0) {
  textContentPatched += textContentParts.shift();
  await fileContentAttribute.set(textContentPatched);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions