consumet / consumet.ts

Nodejs library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.
https://consumet.org/extensions/list/
GNU General Public License v3.0
393 stars 222 forks source link

fix(util): fix null TypeError in getHashFromImage #446

Closed bitknox closed 8 months ago

bitknox commented 8 months ago

What kind of change does this PR introduce?

bugfix

Summary

The null guard in getImageFromHash was implemented incorrectly causing a null TypeError when the URL is null or undefined. I have not followed up on what is going on with blurhash, but currently, the code does not do anything regardless, so we might be better off removing it.

bitknox commented 8 months ago

What does dist/utils/utils.js:160 mean?

if ((url === null || url === void 0 ? void 0 : url.length) === 0) {

if (url?.length === 0) {

Looks like the transpiled version of optional chaining. It was added in ES2020, but we are targeting ES2017.