|  | @@ -1,4 +1,6 @@
 | 
	
		
			
			| 1 | 1 |  # coding: utf8
 | 
	
		
			
			|  | 2 | +import os
 | 
	
		
			
			|  | 3 | +
 | 
	
		
			
			| 2 | 4 |  import transaction
 | 
	
		
			
			| 3 | 5 |  import re
 | 
	
		
			
			| 4 | 6 |  from datetime import datetime
 | 
	
	
		
			
			|  | @@ -236,13 +238,20 @@ class Workspace(DAVCollection):
 | 
	
		
			
			| 236 | 238 |          # TODO : remove commentary here raise DAVError(HTTP_FORBIDDEN)
 | 
	
		
			
			| 237 | 239 |          if '/.deleted/' in self.path or '/.archived/' in self.path:
 | 
	
		
			
			| 238 | 240 |              raise DAVError(HTTP_FORBIDDEN)
 | 
	
		
			
			| 239 |  | -        # TODO: Test ici que la ressource n'existe pas déjà
 | 
	
		
			
			| 240 |  | -        # Si oui on retourne le document déjà existant ?
 | 
	
		
			
			|  | 241 | +
 | 
	
		
			
			|  | 242 | +        content = None
 | 
	
		
			
			|  | 243 | +
 | 
	
		
			
			|  | 244 | +        # Note: To prevent bugs, check here again if resource already exist
 | 
	
		
			
			|  | 245 | +        path = os.path.join(self.path, file_name)
 | 
	
		
			
			|  | 246 | +        resource = self.provider.getResourceInst(path, self.environ)
 | 
	
		
			
			|  | 247 | +        if resource:
 | 
	
		
			
			|  | 248 | +            content = resource.content
 | 
	
		
			
			|  | 249 | +
 | 
	
		
			
			| 241 | 250 |          return FakeFileStream(
 | 
	
		
			
			| 242 | 251 |              file_name=file_name,
 | 
	
		
			
			| 243 | 252 |              content_api=self.content_api,
 | 
	
		
			
			| 244 | 253 |              workspace=self.workspace,
 | 
	
		
			
			| 245 |  | -            content=None,
 | 
	
		
			
			|  | 254 | +            content=content,
 | 
	
		
			
			| 246 | 255 |              parent=self.content,
 | 
	
		
			
			| 247 | 256 |              path=self.path + '/' + file_name
 | 
	
		
			
			| 248 | 257 |          )
 |