html-get 2.24.2 → 2.24.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/html.js +8 -9
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "html-get",
3
3
  "description": "Get the HTML from any website, fine-tuned for correction & speed",
4
4
  "homepage": "https://nicedoc.com/microlinkhq/html-get",
5
- "version": "2.24.2",
5
+ "version": "2.24.3",
6
6
  "types": "index.d.ts",
7
7
  "main": "src/index.js",
8
8
  "bin": {
package/src/html.js CHANGED
@@ -142,15 +142,14 @@ const replaceCssUrls = (url, stylesheet) => {
142
142
  )
143
143
 
144
144
  cssUrls.forEach(cssUrl => {
145
- if (cssUrl.startsWith('/')) {
146
- try {
147
- const absoluteUrl = new URL(cssUrl, url).toString()
148
- stylesheet = stylesheet.replaceAll(
149
- `url(${cssUrl})`,
150
- `url(${absoluteUrl})`
151
- )
152
- } catch (_) {}
153
- }
145
+ if (/^(?:https?|data):/.test(cssUrl)) return
146
+ try {
147
+ const absoluteUrl = new URL(cssUrl, url).toString()
148
+ stylesheet = stylesheet.replaceAll(
149
+ `url(${cssUrl})`,
150
+ `url(${absoluteUrl})`
151
+ )
152
+ } catch (_) {}
154
153
  })
155
154
 
156
155
  return stylesheet