|  |  | @ -59,12 +59,13 @@ class Local extends \OC\Files\Storage\Common { | 
			
		
	
		
			
				
					|  |  |  | 		if (!isset($arguments['datadir']) || !is_string($arguments['datadir'])) { | 
			
		
	
		
			
				
					|  |  |  | 			throw new \InvalidArgumentException('No data directory set for local storage'); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		$this->datadir = $arguments['datadir']; | 
			
		
	
		
			
				
					|  |  |  | 		$this->datadir = str_replace('//', '/', $arguments['datadir']); | 
			
		
	
		
			
				
					|  |  |  | 		// some crazy code uses a local storage on root...
 | 
			
		
	
		
			
				
					|  |  |  | 		if ($this->datadir === '/') { | 
			
		
	
		
			
				
					|  |  |  | 			$this->realDataDir = $this->datadir; | 
			
		
	
		
			
				
					|  |  |  | 		} else { | 
			
		
	
		
			
				
					|  |  |  | 			$this->realDataDir = rtrim(realpath($this->datadir), '/') . '/'; | 
			
		
	
		
			
				
					|  |  |  | 			$realPath = realpath($this->datadir) ?: $this->datadir; | 
			
		
	
		
			
				
					|  |  |  | 			$this->realDataDir = rtrim($realPath, '/') . '/'; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		if (substr($this->datadir, -1) !== '/') { | 
			
		
	
		
			
				
					|  |  |  | 			$this->datadir .= '/'; | 
			
		
	
	
		
			
				
					|  |  | @ -361,14 +362,18 @@ class Local extends \OC\Files\Storage\Common { | 
			
		
	
		
			
				
					|  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  | 	public function getSourcePath($path) { | 
			
		
	
		
			
				
					|  |  |  | 		$fullPath = $this->datadir . $path; | 
			
		
	
		
			
				
					|  |  |  | 		if ($this->allowSymlinks || $path === '') { | 
			
		
	
		
			
				
					|  |  |  | 		$currentPath = $path; | 
			
		
	
		
			
				
					|  |  |  | 		if ($this->allowSymlinks || $currentPath === '') { | 
			
		
	
		
			
				
					|  |  |  | 			return $fullPath; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		$pathToResolve = $fullPath; | 
			
		
	
		
			
				
					|  |  |  | 		$realPath = realpath($pathToResolve); | 
			
		
	
		
			
				
					|  |  |  | 		while ($realPath === false) { // for non existing files check the parent directory
 | 
			
		
	
		
			
				
					|  |  |  | 			$pathToResolve = dirname($pathToResolve); | 
			
		
	
		
			
				
					|  |  |  | 			$realPath = realpath($pathToResolve); | 
			
		
	
		
			
				
					|  |  |  | 			$currentPath = dirname($currentPath); | 
			
		
	
		
			
				
					|  |  |  | 			if ($currentPath === '' || $currentPath === '.') { | 
			
		
	
		
			
				
					|  |  |  | 				return $fullPath; | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  | 			$realPath = realpath($this->datadir . $currentPath); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		if ($realPath) { | 
			
		
	
		
			
				
					|  |  |  | 			$realPath = $realPath . '/'; | 
			
		
	
	
		
			
				
					|  |  | 
 |