Fix TypeError due to invalid URL (#1206)
This commit is contained in:
		
							parent
							
								
									738333efa3
								
							
						
					
					
						commit
						30718b9e1b
					
				@ -244,36 +244,39 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, o
 | 
			
		||||
              paddingRight: '15px'
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            const { provider, id, meta } = parseEmbedUrl(href)
 | 
			
		||||
 | 
			
		||||
            // Youtube video embed
 | 
			
		||||
            if (provider === 'youtube') {
 | 
			
		||||
              return (
 | 
			
		||||
                <div style={videoWrapperStyles}>
 | 
			
		||||
                  <YouTube
 | 
			
		||||
                    videoId={id} className={styles.videoContainer} opts={{
 | 
			
		||||
                      playerVars: {
 | 
			
		||||
                        start: meta?.start || 0
 | 
			
		||||
                      }
 | 
			
		||||
                    }}
 | 
			
		||||
                  />
 | 
			
		||||
                </div>
 | 
			
		||||
              )
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Rumble video embed
 | 
			
		||||
            if (provider === 'rumble') {
 | 
			
		||||
              return (
 | 
			
		||||
                <div style={videoWrapperStyles}>
 | 
			
		||||
                  <div className={styles.videoContainer}>
 | 
			
		||||
                    <iframe
 | 
			
		||||
                      title='Rumble Video'
 | 
			
		||||
                      allowFullScreen=''
 | 
			
		||||
                      src={meta?.href}
 | 
			
		||||
            try {
 | 
			
		||||
              const { provider, id, meta } = parseEmbedUrl(href)
 | 
			
		||||
              // Youtube video embed
 | 
			
		||||
              if (provider === 'youtube') {
 | 
			
		||||
                return (
 | 
			
		||||
                  <div style={videoWrapperStyles}>
 | 
			
		||||
                    <YouTube
 | 
			
		||||
                      videoId={id} className={styles.videoContainer} opts={{
 | 
			
		||||
                        playerVars: {
 | 
			
		||||
                          start: meta?.start || 0
 | 
			
		||||
                        }
 | 
			
		||||
                      }}
 | 
			
		||||
                    />
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
              )
 | 
			
		||||
                )
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              // Rumble video embed
 | 
			
		||||
              if (provider === 'rumble') {
 | 
			
		||||
                return (
 | 
			
		||||
                  <div style={videoWrapperStyles}>
 | 
			
		||||
                    <div className={styles.videoContainer}>
 | 
			
		||||
                      <iframe
 | 
			
		||||
                        title='Rumble Video'
 | 
			
		||||
                        allowFullScreen=''
 | 
			
		||||
                        src={meta?.href}
 | 
			
		||||
                      />
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
                )
 | 
			
		||||
              }
 | 
			
		||||
            } catch {
 | 
			
		||||
            // ignore invalid URLs
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // assume the link is an image which will fallback to link if it's not
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user