diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-08-24 19:30:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 19:30:30 +0200 |
commit | b1410df18e682e87aee28fb010c727c30939f5f6 (patch) | |
tree | 9c6aa32a230ca6599ca1e1527775558df0fe9bbb /apps/files_external | |
parent | 48f5cbe439115352493bfe01a630c11f9202057f (diff) | |
parent | 4ff1d287d2f5c22b3cf9f6cfa0bfa7574d2d02b9 (diff) | |
download | nextcloud-server-b1410df18e682e87aee28fb010c727c30939f5f6.tar.gz nextcloud-server-b1410df18e682e87aee28fb010c727c30939f5f6.zip |
Merge pull request #10803 from nextcloud/smb-dir-instead-of-allinfo
prefer using dir instead of allinfo for getting smb file info
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php | 8 | ||||
-rw-r--r-- | apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php index fcdf7e3e879..8dce76cb774 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php +++ b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php @@ -35,13 +35,17 @@ class TimeZoneProvider { public function get() { if (!$this->timeZone) { $net = $this->system->getNetPath(); - if ($net) { + // for local domain names we can assume same timezone + if ($net && strpos($this->host, '.') !== false) { $command = sprintf('%s time zone -S %s', $net, escapeshellarg($this->host) ); $this->timeZone = exec($command); - } else { // fallback to server timezone + } + + if ($this->timeZone) { + // fallback to server timezone $this->timeZone = date_default_timezone_get(); } } diff --git a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php index ca88af219a8..4ef0be583d5 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php @@ -13,6 +13,7 @@ use Icewind\SMB\Exception\DependencyException; use Icewind\SMB\Exception\FileInUseException; use Icewind\SMB\Exception\InvalidTypeException; use Icewind\SMB\Exception\NotFoundException; +use Icewind\SMB\IFileInfo; use Icewind\SMB\INotifyHandler; use Icewind\SMB\IServer; use Icewind\SMB\System; @@ -153,6 +154,18 @@ class Share extends AbstractShare { * @return \Icewind\SMB\IFileInfo */ public function stat($path) { + // some windows server setups don't seem to like the allinfo command + // use the dir command instead to get the file info where possible + if ($path !== "" && $path !== "/") { + $parent = dirname($path); + $dir = $this->dir($parent); + $file = array_values(array_filter($dir, function(IFileInfo $info) use ($path) { + return $info->getPath() === $path; + })); + if ($file) { + return $file[0]; + } + } $escapedPath = $this->escapePath($path); $output = $this->execute('allinfo ' . $escapedPath); // Windows and non Windows Fileserver may respond different |