music: fetch again with get if head fails
This commit is contained in:
		
							parent
							
								
									a3e092c78d
								
							
						
					
					
						commit
						a7c17c195b
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -574,9 +574,16 @@ command.callback = async function (
 | 
			
		|||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          if (argStr.match(/^https?:\/\//)) {
 | 
			
		||||
            const contentType = await fetch(argStr, {method: "HEAD"}).then(
 | 
			
		||||
            let contentType = await fetch(argStr, {method: "HEAD"}).then(
 | 
			
		||||
              (res) => res.headers.get("Content-Type")
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            if (!contentType) {
 | 
			
		||||
              contentType = await fetch(argStr, {method: "GET"}).then((res) =>
 | 
			
		||||
                res.headers.get("Content-Type")
 | 
			
		||||
              );
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (
 | 
			
		||||
              contentType.startsWith("audio/") ||
 | 
			
		||||
              contentType.startsWith("video/")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue