Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion functions/avatar/avatarHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ class AvatarHtml {

let relIcons = this.findRelIcons();
if(relIcons.length) {
if(relIcons[0].type === "x-icon" || relIcons[0].href && relIcons[0].href.endsWith(".ico")) {
const isIco = relIcons[0].type === 'x-icon'
|| relIcons[0].href.split(/[#?]/)[0].endsWith('.ico');

if(isIco) {
let pngBuffer = await this.convertIcoToPng(relIcons[0].href, width);
return this.optimizeAvatar(pngBuffer, width, "png");
} else {
Expand Down
4 changes: 3 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const AvatarHtml = require("./functions/avatar/avatarHtml");
// let url = "https://www.youtube.com/watch?v=eRRkvI-w5Ik";
// let url = "https://lynnandtonic.com";
// let url = "https://sarah.dev/";
let url = "https://changelog.com/jsparty/217";
// let url = "https://changelog.com/jsparty/217";
let url = "https://everyday.app/" // [favicon] ico with search params

console.log( url );
let avatar = new AvatarHtml(url);
let html = await avatar.fetch();
Expand Down