mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix:Handle podcast RSS feeds with iso-8859-1 encoding #1489
This commit is contained in:
		
							parent
							
								
									2ad03bcb9a
								
							
						
					
					
						commit
						33846e46fa
					
				
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -2314,4 +2314,4 @@ | ||||
|       "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" | ||||
|     } | ||||
|   } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -191,7 +191,17 @@ module.exports.parsePodcastRssFeedXml = async (xml, excludeEpisodeMetadata = fal | ||||
| 
 | ||||
| module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => { | ||||
|   Logger.debug(`[podcastUtils] getPodcastFeed for "${feedUrl}"`) | ||||
|   return axios.get(feedUrl, { timeout: 6000 }).then(async (data) => { | ||||
|   return axios.get(feedUrl, { timeout: 6000, responseType: 'arraybuffer' }).then(async (data) => { | ||||
| 
 | ||||
|     // Adding support for ios-8859-1 encoded RSS feeds.
 | ||||
|     //  See: https://github.com/advplyr/audiobookshelf/issues/1489
 | ||||
|     const contentType = data.headers?.['content-type'] || '' // e.g. text/xml; charset=iso-8859-1
 | ||||
|     if (contentType.toLowerCase().includes('iso-8859-1')) { | ||||
|       data.data = data.data.toString('latin1') | ||||
|     } else { | ||||
|       data.data = data.data.toString() | ||||
|     } | ||||
| 
 | ||||
|     if (!data || !data.data) { | ||||
|       Logger.error(`[podcastUtils] getPodcastFeed: Invalid podcast feed request response (${feedUrl})`) | ||||
|       return false | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user