Bluesky app fork with some witchin' additions ๐Ÿ’ซ witchsky.app
bluesky fork

Make Steam uri validate #59

This fixes a regression caused by the sanitation update where links using the steam:// protocol will fail the check. Examples: at://did:plc:iif6bnwns5ikitrpwvlz2eo5/app.bsky.actor.profile/self (the website field) at://did:plc:iif6bnwns5ikitrpwvlz2eo5/app.bsky.feed.post/3leh2gsfu4u23 (the app.bsky.richtext.facet#link)

Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:iif6bnwns5ikitrpwvlz2eo5/sh.tangled.repo.pull/3mejgrpjejw22
+2 -2
Diff #0
+1 -1
src/components/RichText.tsx
··· 13 13 const WORD_WRAP = {wordWrap: 1} 14 14 // lifted from facet detection in `RichText` impl, _without_ `gm` flags 15 15 const URL_REGEX = 16 - /(^|\s|\()((https?:\/\/[\S]+)|((?<domain>[a-z][a-z0-9]*(\.[a-z0-9]+)+)[\S]*))/i 16 + /(^|\s|\()((https?:\/\/[\S]+)|(steam:\/\/[\S]+)|((?<domain>[a-z][a-z0-9]*(\.[a-z0-9]+)+)[\S]*))/i 17 17 18 18 export type RichTextProps = TextStyleProp & 19 19 Pick<TextProps, 'selectable' | 'onLayout' | 'onTextLayout'> & {
+1 -1
src/lib/strings/website.ts
··· 4 4 5 5 export function sanitizeWebsiteForLink(website: string): string { 6 6 const normalized = website.toLowerCase() 7 - return normalized.startsWith('https') 7 + return normalized.startsWith('https') || normalized.startsWith('steam') 8 8 ? normalized 9 9 : `https://${website.toLowerCase()}` 10 10 }

History

1 round 1 comment
sign up or login to add to the discussion
1 commit
expand
add steam uri to regex and make steam uri sanatize
no conflicts, ready to merge
expand 1 comment

how about making a separate array of allowed schemes and iterating over it to make adding more easier? allowing any is probably also an option