rehype-og-card 0.4.1 → 0.4.2
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/util/network.js +6 -2
- package/package.json +1 -1
package/dist/util/network.js
CHANGED
|
@@ -19,9 +19,13 @@ import scraper from "open-graph-scraper";
|
|
|
19
19
|
*/
|
|
20
20
|
const isValidURL = (url) => {
|
|
21
21
|
const ALLOWED_PROTOCOLS = ["http:", "https:"];
|
|
22
|
+
const lowerCaseURL = url.toLowerCase();
|
|
23
|
+
const isLikelyURL = ALLOWED_PROTOCOLS.some((protocol) => lowerCaseURL.startsWith(protocol));
|
|
24
|
+
if (!isLikelyURL)
|
|
25
|
+
return false;
|
|
22
26
|
try {
|
|
23
|
-
|
|
24
|
-
return
|
|
27
|
+
new URL(url);
|
|
28
|
+
return true;
|
|
25
29
|
}
|
|
26
30
|
catch (_a) {
|
|
27
31
|
return false;
|