nuxt-og-image 2.0.0-beta.3 → 2.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "2.0.0-beta.3"
8
+ "version": "2.0.0-beta.5"
9
9
  }
package/dist/module.mjs CHANGED
@@ -167,7 +167,7 @@ function getBodyJson(req) {
167
167
  function decodeHtmlEntities(obj) {
168
168
  Object.entries(obj).forEach(([key, value]) => {
169
169
  if (typeof value === "string") {
170
- obj[key] = value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#x27;/g, "'").replace(/&#x2F;/g, "/");
170
+ obj[key] = value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x27;/g, "'").replace(/&#x2F;/g, "/");
171
171
  }
172
172
  });
173
173
  return obj;
@@ -185,11 +185,13 @@ function extractOgImageOptions(html) {
185
185
  console.warn("Failed to parse #nuxt-og-image-options", e, options);
186
186
  }
187
187
  if (options) {
188
- const description = html.match(/<meta property="og:description" content="(.*?)">/)?.[1];
189
- if (description)
190
- options.description = description;
191
- else
192
- options.description = html.match(/<meta name="description" content="(.*?)">/)?.[1];
188
+ if (!options.description) {
189
+ const description = html.match(/<meta property="og:description" content="(.*?)">/)?.[1];
190
+ if (description)
191
+ options.description = description;
192
+ else
193
+ options.description = html.match(/<meta name="description" content="(.*?)">/)?.[1];
194
+ }
193
195
  return decodeHtmlEntities(options);
194
196
  }
195
197
  return false;
@@ -1,7 +1,7 @@
1
1
  function decodeHtmlEntities(obj) {
2
2
  Object.entries(obj).forEach(([key, value]) => {
3
3
  if (typeof value === "string") {
4
- obj[key] = value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#x27;/g, "'").replace(/&#x2F;/g, "/");
4
+ obj[key] = value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x27;/g, "'").replace(/&#x2F;/g, "/");
5
5
  }
6
6
  });
7
7
  return obj;
@@ -19,11 +19,13 @@ export function extractOgImageOptions(html) {
19
19
  console.warn("Failed to parse #nuxt-og-image-options", e, options);
20
20
  }
21
21
  if (options) {
22
- const description = html.match(/<meta property="og:description" content="(.*?)">/)?.[1];
23
- if (description)
24
- options.description = description;
25
- else
26
- options.description = html.match(/<meta name="description" content="(.*?)">/)?.[1];
22
+ if (!options.description) {
23
+ const description = html.match(/<meta property="og:description" content="(.*?)">/)?.[1];
24
+ if (description)
25
+ options.description = description;
26
+ else
27
+ options.description = html.match(/<meta name="description" content="(.*?)">/)?.[1];
28
+ }
27
29
  return decodeHtmlEntities(options);
28
30
  }
29
31
  return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.3",
4
+ "version": "2.0.0-beta.5",
5
5
  "packageManager": "pnpm@7.8.0",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",