|
|
|
@ -115,6 +115,8 @@ class Mapper |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $logicPath |
|
|
|
* @return null |
|
|
|
* @throws \OC\DatabaseException |
|
|
|
*/ |
|
|
|
private function resolveLogicPath($logicPath) { |
|
|
|
$logicPath = $this->resolveRelativePath($logicPath); |
|
|
|
@ -162,7 +164,8 @@ class Mapper |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $logicPath |
|
|
|
* @param boolean $store |
|
|
|
* @param bool $store |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
private function create($logicPath, $store) { |
|
|
|
$logicPath = $this->resolveRelativePath($logicPath); |
|
|
|
@ -191,7 +194,9 @@ class Mapper |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param integer $index |
|
|
|
* @param string $path |
|
|
|
* @param int $index |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
public function slugifyPath($path, $index = null) { |
|
|
|
$path = $this->stripRootFolder($path, $this->unchangedPhysicalRoot); |
|
|
|
@ -205,7 +210,7 @@ class Mapper |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
$sluggedElements[] = self::slugify($pathElement); |
|
|
|
$sluggedElements[] = $this->slugify($pathElement); |
|
|
|
} |
|
|
|
|
|
|
|
// apply index to file name
|
|
|
|
@ -253,13 +258,18 @@ class Mapper |
|
|
|
// trim ending dots (for security reasons and win compatibility)
|
|
|
|
$text = preg_replace('~\.+$~', '', $text); |
|
|
|
|
|
|
|
if (empty($text)) { |
|
|
|
if (empty($text) || \OC\Files\Filesystem::isFileBlacklisted($text)) { |
|
|
|
/** |
|
|
|
* Item slug would be empty. Previously we used uniqid() here. |
|
|
|
* However this means that the behaviour is not reproducible, so |
|
|
|
* when uploading files into a "empty" folder, the folders name is |
|
|
|
* different. |
|
|
|
* |
|
|
|
* The other case is, that the slugified name would be a blacklisted |
|
|
|
* filename. In this case we just use the same workaround by |
|
|
|
* returning the secure md5 hash of the original name. |
|
|
|
* |
|
|
|
* |
|
|
|
* If there would be a md5() hash collision, the deduplicate check |
|
|
|
* will spot this and append an index later, so this should not be |
|
|
|
* a problem. |
|
|
|
|