forked from EVOgeek/Vmeda.Online
		
	Merge pull request #1768 from dpalou/MOBILE-2869
MOBILE-2869 core: Support '*' as accepted file types
This commit is contained in:
		
						commit
						a1271ac2c0
					
				| @ -77,7 +77,9 @@ export class CoreAttachmentsComponent implements OnInit { | ||||
|             this.maxSubmissionsReadable = String(this.maxSubmissions); | ||||
|         } | ||||
| 
 | ||||
|         if (this.acceptedTypes && this.acceptedTypes.trim()) { | ||||
|         this.acceptedTypes = this.acceptedTypes && this.acceptedTypes.trim(); | ||||
| 
 | ||||
|         if (this.acceptedTypes && this.acceptedTypes != '*') { | ||||
|             this.fileTypes = this.fileUploaderProvider.prepareFiletypeList(this.acceptedTypes); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -333,9 +333,16 @@ export class CoreFileUploaderProvider { | ||||
|      * Parse filetypeList to get the list of allowed mimetypes and the data to render information. | ||||
|      * | ||||
|      * @param {string} filetypeList Formatted string list where the mimetypes can be checked. | ||||
|      * @return {{info: any[], mimetypes: string[]}}  Mimetypes and the filetypes informations. | ||||
|      * @return {{info: any[], mimetypes: string[]}}  Mimetypes and the filetypes informations. Undefined if all types supported. | ||||
|      */ | ||||
|     prepareFiletypeList(filetypeList: string): { info: any[], mimetypes: string[] } { | ||||
|         filetypeList = filetypeList && filetypeList.trim(); | ||||
| 
 | ||||
|         if (!filetypeList || filetypeList == '*') { | ||||
|             // All types supported, return undefined.
 | ||||
|             return undefined; | ||||
|         } | ||||
| 
 | ||||
|         const filetypes = filetypeList.split(/[;, ]+/g), | ||||
|             mimetypes = {}, // Use an object to prevent duplicates.
 | ||||
|             typesInfo = []; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user