[Glitch] Fix uninformative error message when uploading unsupported image files
Port be637146f310d7ec3a49d01e850959514e9e4964 to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
		
							parent
							
								
									572e89e563
								
							
						
					
					
						commit
						9d41a410a3
					
				@ -138,7 +138,7 @@ const resizeImage = (img, type = 'image/png') => new Promise((resolve, reject) =
 | 
			
		||||
    .catch(reject);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default inputFile => new Promise((resolve, reject) => {
 | 
			
		||||
export default inputFile => new Promise((resolve) => {
 | 
			
		||||
  if (!inputFile.type.match(/image.*/) || inputFile.type === 'image/gif') {
 | 
			
		||||
    resolve(inputFile);
 | 
			
		||||
    return;
 | 
			
		||||
@ -153,5 +153,5 @@ export default inputFile => new Promise((resolve, reject) => {
 | 
			
		||||
    resizeImage(img, inputFile.type)
 | 
			
		||||
      .then(resolve)
 | 
			
		||||
      .catch(() => resolve(inputFile));
 | 
			
		||||
  }).catch(reject);
 | 
			
		||||
  }).catch(() => resolve(inputFile));
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user