mirror of
				https://github.com/cinnyapp/cinny.git
				synced 2025-11-04 06:20:28 +03:00 
			
		
		
		
	Allow mimetypes with suffix in safe check (#808)
This commit is contained in:
		
							parent
							
								
									bdc10fb729
								
							
						
					
					
						commit
						678e0dc6ac
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -26,12 +26,13 @@ export const ALLOWED_BLOB_MIMETYPES = [
 | 
			
		|||
];
 | 
			
		||||
 | 
			
		||||
export function getBlobSafeMimeType(mimetype) {
 | 
			
		||||
  if (!ALLOWED_BLOB_MIMETYPES.includes(mimetype)) {
 | 
			
		||||
  const [type] = mimetype.split(';');
 | 
			
		||||
  if (!ALLOWED_BLOB_MIMETYPES.includes(type)) {
 | 
			
		||||
    return 'application/octet-stream';
 | 
			
		||||
  }
 | 
			
		||||
  // Required for Chromium browsers
 | 
			
		||||
  if (mimetype === 'video/quicktime') {
 | 
			
		||||
  if (type === 'video/quicktime') {
 | 
			
		||||
    return 'video/mp4';
 | 
			
		||||
  }
 | 
			
		||||
  return mimetype;
 | 
			
		||||
  return type;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue