nuxt-og-image 6.7.7 → 6.7.8
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
|
@@ -18,6 +18,7 @@ const RE_HASH_SEGMENT = /^o_([a-z0-9]+)$/i;
|
|
|
18
18
|
const RE_COMMA_PARAM_SEPARATOR = /,(?=\w+_)/;
|
|
19
19
|
const RE_SIGNATURE_SUFFIX = /,s_[^,]+$/;
|
|
20
20
|
const RE_NON_ASCII = /[^\u0000-\u007F]/;
|
|
21
|
+
const RE_WINDOWS_RESERVED_FILENAME_CHARACTERS = /[<>:"/\\|?*\u0000-\u001F]/;
|
|
21
22
|
const PARAM_ALIASES = {
|
|
22
23
|
w: "width",
|
|
23
24
|
h: "height",
|
|
@@ -149,7 +150,7 @@ export function encodeOgImageParams(options, defaults) {
|
|
|
149
150
|
} else {
|
|
150
151
|
const escaped = str.startsWith("~") ? `~${str}` : str;
|
|
151
152
|
const encoded = encodeURIComponent(escaped.replace(RE_UNDERSCORE, "__")).replace(RE_PERCENT20, "+");
|
|
152
|
-
if (encoded.includes("%")) {
|
|
153
|
+
if (encoded.includes("%") || RE_WINDOWS_RESERVED_FILENAME_CHARACTERS.test(str)) {
|
|
153
154
|
parts.push(`${alias}_~${b64Encode(str)}`);
|
|
154
155
|
} else {
|
|
155
156
|
parts.push(`${alias}_${encoded}`);
|