fedimbed: fix newlines getting stripped
This commit is contained in:
		
							parent
							
								
									b46c711b65
								
							
						
					
					
						commit
						fe37faedc0
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -190,7 +190,8 @@ async function processUrl(msg, url) {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    content = postData.content;
 | 
					    content =
 | 
				
			||||||
 | 
					      postData._misskey_content ?? postData.source?.content ?? postData.content;
 | 
				
			||||||
    cw = postData.summary;
 | 
					    cw = postData.summary;
 | 
				
			||||||
    timestamp = postData.published;
 | 
					    timestamp = postData.published;
 | 
				
			||||||
    for (const attachment of postData.attachment) {
 | 
					    for (const attachment of postData.attachment) {
 | 
				
			||||||
| 
						 | 
					@ -251,6 +252,7 @@ async function processUrl(msg, url) {
 | 
				
			||||||
  cw = cw ?? "";
 | 
					  cw = cw ?? "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // TODO: convert certain HTML tags back to markdown
 | 
					  // TODO: convert certain HTML tags back to markdown
 | 
				
			||||||
 | 
					  content = content.replace(/<br>/g, "\n");
 | 
				
			||||||
  content = content.replace(/(<([^>]+)>)/gi, "");
 | 
					  content = content.replace(/(<([^>]+)>)/gi, "");
 | 
				
			||||||
  content = parseHtmlEntities(content);
 | 
					  content = parseHtmlEntities(content);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -405,7 +407,7 @@ async function processUrl(msg, url) {
 | 
				
			||||||
          .then((buf) => Buffer.from(buf));
 | 
					          .then((buf) => Buffer.from(buf));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        files.push({
 | 
					        files.push({
 | 
				
			||||||
          name: attachment.type.replace("/", ".").replace("mpeg","mp3"),
 | 
					          name: attachment.type.replace("/", ".").replace("mpeg", "mp3"),
 | 
				
			||||||
          contents: file,
 | 
					          contents: file,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue