This topic was automatically generated from Slack. You can find the original thread here.
I am using the Wordpress ORG component.
I am trying to put the following sample content into the CONTENT field.
<!-- wp:paragraph -->
<p>When the police searched the car, they found nearly $75,000 in cash and a small clear bag containing 31 white oxycodone tablets. According to the <a href="https://www.cdc.gov/opioids/basics/prescribed.html" target="_blank" rel="noreferrer noopener">CDC</a>, oxycodone is an opioid drug that treats pain and can be highly addictive. Overdosing on prescription opioids can stop breathing and lead to death.</p>
<!-- /wp:paragraph -->
How should I filter it so that I don’t get any errors?
To avoid any errors while posting the content to WordPress, you need to ensure that the HTML entities are properly decoded. In Node.js, you can use the he library to decode HTML entities. Here’s how you can do it: import { axios } from "@pipedream/platform"; import he from "he"; export default defineComponent({ props: { wordpress: { type: "app", app: "wordpress_org", }, content: { type: "string", label: "Content", description: "The content to post", }, }, async run({ steps, $ }) { const decodedContent = he.decode(this.content); // Add the axios configuration object to make the HTTP request here // Use `decodedContent` as the content in your request }, }); In the above code, he.decode(this.content) will decode the HTML entities in your content. You can then use decodedContent in your request to WordPress.
Sure, you can use the he library to decode HTML entities in a separate piece of code. Here is a simple example: import he from "he"; export default defineComponent({ props: { content: { type: "string", label: "Content", description: "The content to decode", }, }, async run() { const decodedContent = he.decode(this.content); return { decodedContent }; }, }); In this code, content is a prop that you can input your HTML string into. The run method decodes the HTML entities in the content and returns the decoded content.
I’m sorry to hear that you’re experiencing issues. The errors you’re seeing are typically associated with a problem in making a network request. The ENOTFOUND error means that the hostname (‘https’) could not be resolved to an IP address. This could be due to a misconfiguration in your request URL or a network issue. Could you please provide more details about the network request you’re trying to make? Specifically, I need to know the URL you’re trying to reach and the context in which this request is being made. This will help me understand the issue better and provide a more accurate solution.