filterOutSystemFiles by own
This commit is contained in:
parent
938e896ce9
commit
638901d956
|
@ -20,6 +20,7 @@ import { getParentFolderName } from './utils';
|
||||||
import { UPLOAD_RESULT, UPLOAD_STRATEGY } from 'constants/upload';
|
import { UPLOAD_RESULT, UPLOAD_STRATEGY } from 'constants/upload';
|
||||||
import uploadManager from 'services/upload/uploadManager';
|
import uploadManager from 'services/upload/uploadManager';
|
||||||
import { addLocalLog, addLogLine } from 'utils/logging';
|
import { addLocalLog, addLogLine } from 'utils/logging';
|
||||||
|
import { filterOutSystemFiles } from 'utils/upload';
|
||||||
|
|
||||||
class watchFolderService {
|
class watchFolderService {
|
||||||
private electronAPIs: ElectronAPIs;
|
private electronAPIs: ElectronAPIs;
|
||||||
|
@ -107,13 +108,15 @@ class watchFolderService {
|
||||||
mapping: WatchMapping,
|
mapping: WatchMapping,
|
||||||
filesOnDisk: ElectronFile[]
|
filesOnDisk: ElectronFile[]
|
||||||
) {
|
) {
|
||||||
const filesToUpload = filesOnDisk.filter((electronFile) => {
|
const filesToUpload = filterOutSystemFiles(
|
||||||
|
filesOnDisk.filter((electronFile) => {
|
||||||
return (
|
return (
|
||||||
!mapping.syncedFiles.find(
|
!mapping.syncedFiles.find(
|
||||||
(file) => file.path === electronFile.path
|
(file) => file.path === electronFile.path
|
||||||
) && !mapping.ignoredFiles.includes(electronFile.path)
|
) && !mapping.ignoredFiles.includes(electronFile.path)
|
||||||
);
|
);
|
||||||
});
|
})
|
||||||
|
) as ElectronFile[];
|
||||||
|
|
||||||
if (filesToUpload.length > 0) {
|
if (filesToUpload.length > 0) {
|
||||||
for (const file of filesToUpload) {
|
for (const file of filesToUpload) {
|
||||||
|
@ -263,11 +266,15 @@ class watchFolderService {
|
||||||
throw Error('no Mapping found for event');
|
throw Error('no Mapping found for event');
|
||||||
}
|
}
|
||||||
if (event.type === 'upload') {
|
if (event.type === 'upload') {
|
||||||
event.files = event.files.filter(
|
event.files = filterOutSystemFiles(
|
||||||
|
event.files.filter(
|
||||||
(file) =>
|
(file) =>
|
||||||
!mapping.ignoredFiles.includes(file.path) &&
|
!mapping.ignoredFiles.includes(file.path) &&
|
||||||
!mapping.syncedFiles.find((f) => f.path === file.path)
|
!mapping.syncedFiles.find(
|
||||||
);
|
(f) => f.path === file.path
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) as ElectronFile[];
|
||||||
if (event.files.length === 0) {
|
if (event.files.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue