UniSharp / laravel-filemanager

Media gallery with CKEditor, TinyMCE and Summernote support. Built on Laravel file system.
https://unisharp.github.io/laravel-filemanager/
MIT License
2.09k stars 720 forks source link

Fix error TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file Lfm.php with change method translateFromUtf8 #1234

Open deyan-ardi opened 6 months ago

deyan-ardi commented 6 months ago

Summary of the change:

Fix error in windows os for feature File Moving

TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file C:\laragon\www\laravel\glagalinggah-cms\vendor\unisharp\laravel-filemanager\src\Lfm.php on line 237

I replace method translateFromUtf8($input) from

 public function translateFromUtf8($input)
    {
        if ($this->isRunningOnWindows()) {
            $input = iconv('UTF-8', mb_detect_encoding($input), $input);
        }

        return $input;
  }

To

    public function translateFromUtf8($input)
    {
        if ($this->isRunningOnWindows()) {
            if (is_array($input)) {
                foreach ($input as $k => $i) {
                    $rInput[] = iconv('UTF-8', mb_detect_encoding($i), $i);
                }
            } else {
                $rInput = $input;
            }
        } else {
            $rInput = $input;
        }

        return $rInput;
    }

I hove this fix cant be merge, i get error message in my server, thanks

deyan-ardi commented 2 days ago

When this update will be merge?