@@ -37,6 +37,7 @@ class SyncLivePhotosListener implements IEventListener {
3737	private  array  $ pendingRenames
3838	/** @var Array<int, bool> */ 
3939	private  array  $ pendingDeletion
40+ 	private  string  $ copyTargetPath'' ;
4041
4142	public  function  __construct (
4243		private  ?Folder $ userFolder
@@ -53,6 +54,10 @@ public function handle(Event $event): void {
5354		}
5455
5556		if  ($ eventinstanceof  BeforeNodeCopiedEvent || $ eventinstanceof  NodeCopiedEvent) {
57+ 			if  ($ this copyTargetPath  === $ eventgetTarget ()->getPath ()) {
58+ 				$ this copyTargetPath  = '' ;
59+ 				return ;
60+ 			}
5661			$ this handleCopyRecursive ($ event$ eventgetSource (), $ eventgetTarget ());
5762		} else  {
5863			$ peerFileIdnull ;
@@ -158,8 +163,10 @@ private function handleCopy(File $sourceFile, File $targetFile, File $peerFile):
158163			// If the copy was a folder copy, then the peer file already exists. 
159164			$ targetPeerFile$ targetParentget ($ peerTargetName
160165		} else  {
166+ 			// Register the target path so we can ignore copy events for this copy. 
167+ 			$ this copyTargetPath  = $ targetParentgetPath () . '/ '  . $ peerTargetName
161168			// If the copy was a file copy, then we need to create the peer file. 
162- 			$ targetPeerFile$ peerFilecopy ($ targetParent -> getPath () .  ' / '  .  $ peerTargetName 
169+ 			$ targetPeerFile$ peerFilecopy ($ this -> copyTargetPath );
163170		}
164171
165172		/** @var FilesMetadata $targetMetadata */ 
0 commit comments