diff --git a/lib/core/services/upload.service.spec.ts b/lib/core/services/upload.service.spec.ts index 8fc4654099..d7407ee73f 100644 --- a/lib/core/services/upload.service.spec.ts +++ b/lib/core/services/upload.service.spec.ts @@ -342,6 +342,14 @@ describe('UploadService', () => { expect(result[0]).toBe(file2); }); + it('should skip files if they are in an excluded folder when path is in options', () => { + const file1: any = { name: 'readmetoo.md', file : {}, options: { path: '/rollingPanda/'}}; + const file2: any = { name: 'readme.md', file : { webkitRelativePath: '/test/' }}; + const result = service.addToQueue(file1, file2); + expect(result.length).toBe(1); + expect(result[0]).toBe(file2); + }); + it('should call onUploadDeleted if file was deleted', async(() => { const file = ({ status: FileUploadStatus.Deleted }); spyOn(service.fileUploadDeleted, 'next'); diff --git a/lib/core/services/upload.service.ts b/lib/core/services/upload.service.ts index 56789e1691..eeb2103c51 100644 --- a/lib/core/services/upload.service.ts +++ b/lib/core/services/upload.service.ts @@ -127,10 +127,11 @@ export class UploadService { private isParentFolderAllowed(file: FileModel): boolean { let isAllowed: boolean = true; const currentFile: any = file.file; - if (currentFile && currentFile.webkitRelativePath) { + const fileRelativePath = currentFile.webkitRelativePath ? currentFile.webkitRelativePath : file.options.path; + if (currentFile && fileRelativePath) { isAllowed = this.excludedFoldersList.filter((folderToExclude) => { - return currentFile.webkitRelativePath + return fileRelativePath .split('/') .some((pathElement) => { const minimatch = new Minimatch(folderToExclude, this.folderMatchingOptions);