Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 72bf939

Browse files
committed
Manual merge of #1292 (put encoding call directly inside win-dedicated function.
1 parent f49aa90 commit 72bf939

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

core/src/plugins/access.smb/smb.php

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
###################################################################
2323
namespace Pydio\Access\Driver\StreamProvider\SMB;
2424

25+
use Pydio\Core\Utils\TextEncoder;
2526
use Pydio\Log\Core\Logger;
2627

2728
define ('SMB4PHP_VERSION', '0.8');
@@ -553,7 +554,7 @@ class smb_stream_wrapper extends smb
553554
{
554555
# variables
555556

556-
public $stream, $url, $parsed_url = array (), $mode, $tmpfile;
557+
public $stream, $url, $parsed_url = array (), $mode, $tmpfile, $defer_stream_read;
557558
public $need_flush = FALSE;
558559
public $dir = array (), $dir_index = -1;
559560

@@ -648,7 +649,6 @@ public function stream_open ($url, $mode, $options, $opened_path)
648649
$url = smb::cleanUrl($url);
649650
$this->url = $url;
650651
$this->mode = $mode;
651-
$this->defer_stream_read;
652652
$this->parsed_url = $pu = smb::parse_url($url);
653653
if ($pu['type'] <> 'path') trigger_error('stream_open(): error in URL', E_USER_ERROR);
654654
switch ($mode) {
@@ -745,38 +745,36 @@ function ConvSmbParameterToWinOs($params)
745745
{
746746

747747
$paramstemp = explode(" ", $params);
748-
749-
// first command '-d' or '-L' ?
750-
if ($paramstemp[0] == "-d") {
751-
$count_params = count($paramstemp);
752748

749+
// first command '-d' or '-L' ?
750+
if ($paramstemp[0] === '-d') {
751+
752+
$count_params = count($paramstemp);
753753
// index command = 4;
754754
// index start path = 6;
755755
$paramstemp[6] = '""'.$paramstemp[6];
756756
$type_cmd = substr($paramstemp[4], 1);
757757
switch ($type_cmd) {
758758

759-
case get:
760-
case put:
761-
case rename:
762-
$index_end_path = $count_params - 2;
763-
$paramstemp[$index_end_path] = $paramstemp[$index_end_path].'""';
764-
$new_params = implode(" ", $paramstemp);
765-
$new_params = str_replace(' ', '"" ""', $new_params);
766-
break;
767-
768-
//Cmd: dir, del, rmdir, mkdir
769-
default:
770-
$index_end_path = $count_params - 2;
771-
$paramstemp[$index_end_path] = $paramstemp[$index_end_path].'""';
772-
$new_params = implode(" ", $paramstemp);
773-
}
759+
case 'get':
760+
case 'put':
761+
case 'rename':
762+
$index_end_path = $count_params - 2;
763+
$paramstemp[$index_end_path] = $paramstemp[$index_end_path].'""';
764+
$new_params = implode(" ", $paramstemp);
765+
$new_params = str_replace(' ', '"" ""', $new_params);
766+
break;
774767

775-
return $new_params;
776-
}
777-
else {
778-
return $params;
768+
//Cmd: dir, del, rmdir, mkdir
769+
default:
770+
$index_end_path = $count_params - 2;
771+
$paramstemp[$index_end_path] = $paramstemp[$index_end_path].'""';
772+
$new_params = implode(" ", $paramstemp);
773+
}
774+
$params = $new_params;
779775
}
776+
777+
return TextEncoder::toStorageEncoding($params);
780778
}
781779

782780
###################################################################

0 commit comments

Comments
 (0)