Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: invisible url when only a protocol (#1059)

* fix: invisible url when only a protocol

- Fixes https://github.com/bluesky-social/social-app/issues/1058

* fix: handle more cases when url is not http/https

authored by

Steven and committed by
GitHub
5a0899b9 44b39292

+4 -1
+4 -1
src/lib/strings/url-helpers.ts
··· 39 39 export function toShortUrl(url: string): string { 40 40 try { 41 41 const urlp = new URL(url) 42 + if (urlp.protocol !== 'http:' && urlp.protocol !== 'https:') { 43 + return url 44 + } 42 45 const shortened = 43 46 urlp.host + 44 47 (urlp.pathname === '/' ? '' : urlp.pathname) + ··· 47 50 if (shortened.length > 30) { 48 51 return shortened.slice(0, 27) + '...' 49 52 } 50 - return shortened 53 + return shortened ? shortened : url 51 54 } catch (e) { 52 55 return url 53 56 }