|
22 | 22 | ###################################################################
|
23 | 23 | namespace Pydio\Access\Driver\StreamProvider\SMB;
|
24 | 24 |
|
| 25 | +use Pydio\Core\Utils\TextEncoder; |
25 | 26 | use Pydio\Log\Core\Logger;
|
26 | 27 |
|
27 | 28 | define ('SMB4PHP_VERSION', '0.8');
|
@@ -553,7 +554,7 @@ class smb_stream_wrapper extends smb
|
553 | 554 | {
|
554 | 555 | # variables
|
555 | 556 |
|
556 |
| - public $stream, $url, $parsed_url = array (), $mode, $tmpfile; |
| 557 | + public $stream, $url, $parsed_url = array (), $mode, $tmpfile, $defer_stream_read; |
557 | 558 | public $need_flush = FALSE;
|
558 | 559 | public $dir = array (), $dir_index = -1;
|
559 | 560 |
|
@@ -648,7 +649,6 @@ public function stream_open ($url, $mode, $options, $opened_path)
|
648 | 649 | $url = smb::cleanUrl($url);
|
649 | 650 | $this->url = $url;
|
650 | 651 | $this->mode = $mode;
|
651 |
| - $this->defer_stream_read; |
652 | 652 | $this->parsed_url = $pu = smb::parse_url($url);
|
653 | 653 | if ($pu['type'] <> 'path') trigger_error('stream_open(): error in URL', E_USER_ERROR);
|
654 | 654 | switch ($mode) {
|
@@ -745,38 +745,36 @@ function ConvSmbParameterToWinOs($params)
|
745 | 745 | {
|
746 | 746 |
|
747 | 747 | $paramstemp = explode(" ", $params);
|
748 |
| - |
749 |
| - // first command '-d' or '-L' ? |
750 |
| - if ($paramstemp[0] == "-d") { |
751 |
| - $count_params = count($paramstemp); |
752 | 748 |
|
| 749 | + // first command '-d' or '-L' ? |
| 750 | + if ($paramstemp[0] === '-d') { |
| 751 | + |
| 752 | + $count_params = count($paramstemp); |
753 | 753 | // index command = 4;
|
754 | 754 | // index start path = 6;
|
755 | 755 | $paramstemp[6] = '""'.$paramstemp[6];
|
756 | 756 | $type_cmd = substr($paramstemp[4], 1);
|
757 | 757 | switch ($type_cmd) {
|
758 | 758 |
|
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; |
774 | 767 |
|
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; |
779 | 775 | }
|
| 776 | + |
| 777 | + return TextEncoder::toStorageEncoding($params); |
780 | 778 | }
|
781 | 779 |
|
782 | 780 | ###################################################################
|
|
0 commit comments