[Pkg-owncloud-commits] [owncloud] 193/394: [files_external] fixes #290
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:12:02 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 01a8af1a1c62c4d012da90800f1c93edf0a5c028
Author: Thomas Mueller <thomas.mueller at tmit.eu>
Date: Thu Dec 6 17:58:56 2012 +0100
[files_external] fixes #290
Background:
the previous opendir call on a file is implemented as a smbclient call:
smbclient -N -U 'user%******' -d 0 //server/testsmb -c 'dir "folder/file.txt/*"
A Samba server will return NT_STATUS_OBJECT_PATH_NOT_FOUND which returns false on the stream wrapper implementation.
A Windows Server/Workstation will return NT_STATUS_INVALID_PARAMETER which will result in an call to trigger_error() and death :-(
Fix:
According to the stream wrapper documentation a call to filetype() will call stat() on the stream wrapper and interpret the the result correctly.
This has been tested with Windows 7 and Samba 3.4.3
---
apps/files_external/lib/smb.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index eed2582..255525c 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -59,7 +59,9 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
}
public function filetype($path) {
- return (bool)@$this->opendir($path) ? 'dir' : 'file';//using opendir causes the same amount of requests and caches the content of the folder in one go
+ // filetype uses stat of the stream wrapper implementation to determine the file type
+ // see: http://php.net/manual/de/streamwrapper.url-stat.php
+ return filetype($this->constructUrl($path));
}
/**
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list