fix: handle web bookmarks with URLs in d tag and prevent crash

- Extract URL from 'd' tag for kind:39701 web bookmarks
- Add protocol prefix (https://) if missing from web bookmark URLs
- Make classifyUrl handle undefined input gracefully
- Prevent crash when web bookmarks have no content
This commit is contained in:
Gigi
2025-10-06 20:34:37 +01:00
parent 1e7be50e35
commit fbb8fbdc20
2 changed files with 13 additions and 3 deletions

View File

@@ -13,7 +13,10 @@ export interface UrlClassification {
buttonText: string
}
export const classifyUrl = (url: string): UrlClassification => {
export const classifyUrl = (url: string | undefined): UrlClassification => {
if (!url) {
return { type: 'article', buttonText: 'READ NOW' }
}
const urlLower = url.toLowerCase()
// Check for YouTube