diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-11-17 16:44:45 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-11-17 16:44:45 +0100 |
commit | 146cb920c9daba10da0bd93efab3e64df97224de (patch) | |
tree | d55b5e13f4b9903cc23b9946ce188e9ad8c62ad7 /lib | |
parent | 36528c6ef622876f9d89d3b0fbfafc8e44f569fb (diff) | |
parent | 6625d5c88f74edade459ec7e2ee0bfb79f21fedd (diff) | |
download | nextcloud-server-146cb920c9daba10da0bd93efab3e64df97224de.tar.gz nextcloud-server-146cb920c9daba10da0bd93efab3e64df97224de.zip |
Merge pull request #12218 from owncloud/issue/10991-fixes
Issue/10991 Make unit tests pass on windows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/filesystem.php | 13 | ||||
-rw-r--r-- | lib/private/security/certificatemanager.php | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index c7dc99c55cb..6c8fa8c90ba 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -698,13 +698,22 @@ class Filesystem { * @param bool $stripTrailingSlash * @return string */ - public static function normalizePath($path, $stripTrailingSlash = true) { + public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false) { if ($path == '') { return '/'; } + //no windows style slashes $path = str_replace('\\', '/', $path); + // When normalizing an absolute path, we need to ensure that the drive-letter + // is still at the beginning on windows + $windows_drive_letter = ''; + if ($isAbsolutePath && \OC_Util::runningOnWindows() && preg_match('#^([a-zA-Z])$#', $path[0]) && $path[1] == ':' && $path[2] == '/') { + $windows_drive_letter = substr($path, 0, 2); + $path = substr($path, 2); + } + //add leading slash if ($path[0] !== '/') { $path = '/' . $path; @@ -733,7 +742,7 @@ class Filesystem { //normalize unicode if possible $path = \OC_Util::normalizeUnicode($path); - return $path; + return $windows_drive_letter . $path; } /** diff --git a/lib/private/security/certificatemanager.php b/lib/private/security/certificatemanager.php index cae9730eb26..a2a4c8b83d2 100644 --- a/lib/private/security/certificatemanager.php +++ b/lib/private/security/certificatemanager.php @@ -49,6 +49,7 @@ class CertificateManager implements ICertificateManager { } catch(\Exception $e) {} } } + closedir($handle); return $result; } |