@metascraper/helpers 5.46.4 → 5.46.10

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/index.js +10 -5
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -222,10 +222,8 @@ const isImageUrl = createIsUrl(IMAGE)
222
222
 
223
223
  const isPdfUrl = createIsUrl(PDF)
224
224
 
225
- const isMediaUrl = memoizeOne(
226
- (url, opts) =>
227
- isImageUrl(url, opts) || isVideoUrl(url, opts) || isAudioUrl(url, opts)
228
- )
225
+ const isMediaUrl = (url, opts) =>
226
+ isImageUrl(url, opts) || isVideoUrl(url, opts) || isAudioUrl(url, opts)
229
227
 
230
228
  const isMediaExtension = url =>
231
229
  isImageExtension(url) || isVideoExtension(url) || isAudioExtension(url)
@@ -286,7 +284,14 @@ const url = (value, { url = '' } = {}) => {
286
284
  if (isUrl(absoluteUrl)) return absoluteUrl
287
285
  } catch (_) {}
288
286
 
289
- return isUri(value) ? value : undefined
287
+ let sanitizedValue = value
288
+ if (value.startsWith('data:')) {
289
+ const [header, data] = value.split(',')
290
+ const cleanData = data.replace(/\s+/g, '')
291
+ sanitizedValue = `${header},${cleanData}`
292
+ }
293
+
294
+ return isUri(sanitizedValue) ? sanitizedValue : undefined
290
295
  }
291
296
 
292
297
  const getISODate = date =>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@metascraper/helpers",
3
3
  "description": "Collection of helper functions used by metascraper",
4
4
  "homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-helpers",
5
- "version": "5.46.4",
5
+ "version": "5.46.10",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "04cb4826cc42f95e86014ac17e2b16ecfa3d1858"
67
+ "gitHead": "d66104b59aa84d93e142ba4404c6d7614c5b4362"
68
68
  }