mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Fix card url matching regex
This commit is contained in:
		| @@ -30,18 +30,24 @@ const matchAccount = ( | |||||||
|   // https://social.xmflsct.com/web/accounts/14195 <- default |   // https://social.xmflsct.com/web/accounts/14195 <- default | ||||||
|   // https://social.xmflsct.com/web/@tooot <- pretty ! cannot be searched on the same instance |   // https://social.xmflsct.com/web/@tooot <- pretty ! cannot be searched on the same instance | ||||||
|   // https://social.xmflsct.com/@tooot <- pretty |   // https://social.xmflsct.com/@tooot <- pretty | ||||||
|   const matcherAccount = new RegExp(/(https?:\/\/)?([^\/]+)(\/web|\/web\/accounts)?\/([0-9]+|@.+)/) |   const matcherAccount = new RegExp( | ||||||
|  |     /(https?:\/\/)?([^\/]+)(\/web\/accounts\/([0-9]+)|\/web\/(@.+)|\/(@.+))/ | ||||||
|  |   ) | ||||||
|  |  | ||||||
|   const matched = url.match(matcherAccount) |   const matched = url.match(matcherAccount) | ||||||
|   if (matched) { |   if (matched) { | ||||||
|     const hostname = matched[2] |     const hostname = matched[2] | ||||||
|     const style = matched[4].startsWith('@') ? 'pretty' : 'default' |     const account = matched.filter(i => i).reverse()?.[0] | ||||||
|     const account = matched[4] |     if (account) { | ||||||
|  |       const style = account.startsWith('@') ? 'pretty' : 'default' | ||||||
|  |  | ||||||
|       const instanceUrl = getInstanceUrl(store.getState()) |       const instanceUrl = getInstanceUrl(store.getState()) | ||||||
|       return style === 'default' |       return style === 'default' | ||||||
|         ? { id: account, style, sameInstance: hostname === instanceUrl } |         ? { id: account, style, sameInstance: hostname === instanceUrl } | ||||||
|         : { username: account, style, sameInstance: hostname === instanceUrl } |         : { username: account, style, sameInstance: hostname === instanceUrl } | ||||||
|  |     } else { | ||||||
|  |       return null | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   return null |   return null | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user