Browse Source
			
			
			Properly catch exception from writing to stream when copying a file
			
				Signed-off-by: Julius Härtl <jus@bitgrid.net>
			
			
				pull/22739/head
			
			
		 
		
			
				
					
						
						Julius Härtl
					
					5 years ago
					
				 
				
			 
		 
		
			
				
				  
				  No known key found for this signature in database
				  
				  	
						GPG Key ID: 4C614C6ED2CDE6DF
				  	
				  
				
			
		
		
		
	
		
			
				 1 changed files with 
9 additions and 
2 deletions
			 
			
		 
		
			
				- 
					
					
					 
					apps/dav/lib/Connector/Sabre/File.php
				
 
			
		
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -52,6 +52,7 @@ use OCP\Encryption\Exceptions\GenericEncryptionException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\EntityTooLargeException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\FileInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\ForbiddenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\GenericFileException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\InvalidContentException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\InvalidPathException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use OCP\Files\LockNotAcquiredException; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -200,8 +201,14 @@ class File extends Node implements IFile { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$isEOF = feof($stream); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$count = $partStorage->writeStream($internalPartPath, $wrappedData); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$result = $count > 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$result = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$count = -1; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$count = $partStorage->writeStream($internalPartPath, $wrappedData); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} catch (GenericFileException $e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$result = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if ($result === false) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$result = $isEOF; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |