diff options
author | Joas Schilling <coding@schilljs.com> | 2016-11-09 10:58:11 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-11-21 09:23:37 +0100 |
commit | 558f169671208fb349bb40de7b6e0abb02097832 (patch) | |
tree | 716c3e8e0ea965c4a592cfe60618019d7554a57f /lib/private/Files/Cache/Scanner.php | |
parent | 4652d203e37d06b427872888ccb17227c1e0818b (diff) | |
download | nextcloud-server-558f169671208fb349bb40de7b6e0abb02097832.tar.gz nextcloud-server-558f169671208fb349bb40de7b6e0abb02097832.zip |
Move the validation into one place only
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Files/Cache/Scanner.php')
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 237934db7a5..8625e4904ca 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -131,25 +131,14 @@ class Scanner extends BasicEmitter implements IScanner { * @throws \OCP\Lock\LockedException */ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) { - - if (!\OC::$server->getDatabaseConnection()->supports4ByteText()) { - // verify database - e.g. mysql only 3-byte chars - if (preg_match('%(?: - \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 - | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 - | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 -)%xs', $file)) { - // 4-byte characters are not supported in file names + if ($file !== '') { + try { + $this->storage->verifyPath(dirname($file), basename($file)); + } catch (\Exception $e) { return null; } } - try { - $this->storage->verifyPath(dirname($file), basename($file)); - } catch (\Exception $e) { - return null; - } - // only proceed if $file is not a partial file nor a blacklisted file if (!self::isPartialFile($file) and !Filesystem::isFileBlacklisted($file)) { |