Chosen 4.0.0-rc1 drush command chosenplugin doesn't work correctly.

Created on 23 January 2023, about 2 years ago
Updated 25 January 2023, about 2 years ago

Problem/Motivation

The chosen 4.0.0-rc1 drush command chosenplugin doesn't work correctly. In the status report,

Chosen JavaScript file
Not installed 
You need to download the Chosen JavaScript file and extract the entire contents of the archive into the libraries/chosen directory in your Drupal installation directory.

after a the drush command and informations,

 sudo drush chosenplugin
 [notice] The file 2.2.1 was not deleted because it does not exist.
 [notice] A existing Chosen plugin was deleted from libraries
 [success] Chosen plugin has been installed in libraries

After the chosen drush command in web/libraries/chosen there is a subfolder chosen-2.2.1.

Steps to reproduce

Proposed resolution

In file chosen/modules/chosen_lib/src/Commands/ChosenLibCommands.php a change like,

      if ('chosen' !== $dirname) {
        $this->drush_move_dir($dirname, 'chosen');
        $dirname = 'chosen';
      }

to

      if ('chosen' !== $dirname) {
        $subdirname = $dirname . '/chosen-' . $dirname;
        if (is_dir($subdirname)) {
          $this->drush_move_dir($subdirname, 'chosen');
          $fileservice = \Drupal::service('file_system');
          $fileservice->deleteRecursive($dirname);
        } else {
          $this->drush_move_dir($dirname, 'chosen');
        }
        $dirname = 'chosen';
      }

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇫🇷France Chris64 France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024