Skip to content

Commit

Permalink
Merge pull request #84 from mash-up-kr/chore/protocol-relative-url
Browse files Browse the repository at this point in the history
chore: url 후처리 로직 추가
  • Loading branch information
Marades authored Jul 26, 2024
2 parents 82c3283 + 1513258 commit fb9049c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/common/utils/parser.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ export async function parseLinkTitleAndContent(url: string): Promise<{
return {
title: title ?? '',
content,
thumbnail: thumbnail ?? '',
thumbnail: sanitizeThumbnail(thumbnail),
};
}

function sanitizeThumbnail(thumbnail: string) {
if (!thumbnail) {
return '';
}

if (thumbnail.startsWith('//')) {
return thumbnail.substring(2);
}

return thumbnail;
}

0 comments on commit fb9049c

Please sign in to comment.