diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-10-02 19:04:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 19:04:15 +0200 |
commit | bd3d991ab646e28e39a1ea0acb1367e78b7bc33b (patch) | |
tree | 8bf1e736a6221e6a27745411928f08d6082b622f | |
parent | f9c14af9c293c481c73f936c04c90a65f02a8fdf (diff) | |
parent | 5d18d142a625738bba7e6605b0a6b4cf0feab69e (diff) | |
download | nextcloud-server-bd3d991ab646e28e39a1ea0acb1367e78b7bc33b.tar.gz nextcloud-server-bd3d991ab646e28e39a1ea0acb1367e78b7bc33b.zip |
Merge pull request #10804 from nextcloud/smb-dir-instead-of-allinfo-13
[13] prefer using dir instead of allinfo for getting smb file info
-rw-r--r-- | apps/files_external/3rdparty/icewind/smb/src/Share.php | 12 | ||||
-rw-r--r-- | apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php | 8 |
2 files changed, 18 insertions, 2 deletions
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Share.php b/apps/files_external/3rdparty/icewind/smb/src/Share.php index be1ba025508..23b28f16eda 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Share.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Share.php @@ -138,6 +138,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 diff --git a/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php b/apps/files_external/3rdparty/icewind/smb/src/TimeZoneProvider.php index fcdf7e3e879..385d8fccdff 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(); } } |