mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #3978 from sloped/fix/detect-http-https-upgrades
fix: allow upgrading HTTP to HTTPS for redirects
This commit is contained in:
		
						commit
						fd3d4f5fcf
					
				| @ -343,6 +343,14 @@ module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => { | ||||
|       return payload.podcast | ||||
|     }) | ||||
|     .catch((error) => { | ||||
|       // Check for failures due to redirecting from http to https. If original url was http, upgrade to https and try again
 | ||||
|       if (error.code === 'ERR_FR_REDIRECTION_FAILURE' && error.cause.code === 'ERR_INVALID_PROTOCOL') { | ||||
|         if (feedUrl.startsWith('http://') && error.request._options.protocol === 'https:') { | ||||
|           Logger.info('Redirection from http to https detected. Upgrading Request', error.request._options.href) | ||||
|           feedUrl = feedUrl.replace('http://', 'https://') | ||||
|           return this.getPodcastFeed(feedUrl, excludeEpisodeMetadata) | ||||
|         } | ||||
|       } | ||||
|       Logger.error('[podcastUtils] getPodcastFeed Error', error) | ||||
|       return null | ||||
|     }) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user