@@ -40,17 +40,22 @@ public override bool Filter(WebSocketMessage webSocketMessage)
4040 Logger . LogDebug ( $ "EventType: { webSocketMessage . EventType } ", webSocketMessage . ItemPath , webSocketMessage . TargetPath ) ;
4141
4242 string userFileSystemPath = Mapping . ReverseMapPath ( remoteStoragePath ) ;
43+ string userFileSystemParentPath = Path . GetDirectoryName ( userFileSystemPath ) ;
4344 switch ( webSocketMessage . EventType )
4445 {
4546 case "created" :
47+ // Verify that parent folder exists and is not offline.
48+
49+ return ! ( ( Directory . Exists ( userFileSystemParentPath ) && ! new DirectoryInfo ( userFileSystemParentPath ) . Attributes . HasFlag ( FileAttributes . Offline ) ) ||
50+ engine . Placeholders . IsPinned ( userFileSystemParentPath ) ) ;
4651 case "deleted" :
4752 // Verify that parent folder exists and is not offline.
48- string userFileSystemParentPath = Path . GetDirectoryName ( userFileSystemPath ) ;
4953 return ! Directory . Exists ( userFileSystemParentPath )
5054 || new DirectoryInfo ( userFileSystemParentPath ) . Attributes . HasFlag ( FileAttributes . Offline ) ;
5155
5256 case "moved" :
5357 // Verify that source exists OR target folder exists and is not offline.
58+ // TODO: incorrect condition
5459 if ( File . Exists ( userFileSystemPath ) )
5560 {
5661 return false ;
@@ -61,7 +66,7 @@ public override bool Filter(WebSocketMessage webSocketMessage)
6166 string userFileSystemNewPath = Mapping . ReverseMapPath ( remoteStorageNewPath ) ;
6267 string userFileSystemNewParentPath = Path . GetDirectoryName ( userFileSystemNewPath ) ;
6368 return ! Directory . Exists ( userFileSystemNewParentPath )
64- || new DirectoryInfo ( userFileSystemNewParentPath ) . Attributes . HasFlag ( FileAttributes . Offline ) ;
69+ || ( new DirectoryInfo ( userFileSystemNewParentPath ) . Attributes . HasFlag ( FileAttributes . Offline ) && ( ( ( int ) new DirectoryInfo ( userFileSystemNewParentPath ) . Attributes & ( int ) FileAttributesExt . Pinned ) == 0 ) ) ;
6570 }
6671
6772 case "updated" :
@@ -73,13 +78,5 @@ public override bool Filter(WebSocketMessage webSocketMessage)
7378
7479 return true ;
7580 }
76-
77- public override async Task SavePropertiesAsync ( IFileSystemItemMetadata metadata , string userFileSystemPath )
78- {
79- if ( engine . Placeholders . TryGetItem ( userFileSystemPath , out PlaceholderItem placeholderItem ) )
80- {
81- await placeholderItem . SavePropertiesAsync ( metadata as ITHit . FileSystem . Samples . Common . FileSystemItemMetadataExt ) ;
82- }
83- }
8481 }
8582}
0 commit comments