Fixing Kaltura Drop Folder Issues

We recently ran into two issues in the Kaltura drop folder plugin in CE5. The drop folder plugin constantly watches drop folders for new or updated content and ingests it to the Kaltura server.

Issue description

The issue arose when we had several partners and each had configured their ftp drop folder to be at the root of the server – that is the ‘.’ folder. When trying to save the form, we got an error: “Drop folder already exists”.

Kaltura CE5 drop folder profile form

Since drop folder configurations for different partners should not affect each other, we suspected this was a bug.

Solving the issue

We started with looking at the admin console log found at /opt/kaltura/log/admin_console.log. The error shown when submitting the form was “Drop folder with path [.] already exists”.¬†We searched for the error string in the drop folder plugin code found in /opt/kaltura/app/app/plugins/drop_folder, found the error message constant definition and then searched for usages of the constant. There were two places where exceptions with this message are thrown, both in the file /opt/kaltura/app/app/plugins/drop_folder/services/DropFolderService.php. The code is shown below.

Line 73:

$existingDropFolder = DropFolderPeer::retrieveByPathDefaultFilter($dropFolder->path);
if ($existingDropFolder) {
  throw new KalturaAPIException(KalturaDropFolderErrors::DROP_FOLDER_ALREADY_EXISTS, $dropFolder->path);
}

and line 143:

if (!is_null($dropFolder->path) && $dropFolder->path != $dbDropFolder->getPath()) {
  $existingDropFolder = DropFolderPeer::retrieveByPathDefaultFilter($dropFolder->path);
  if ($existingDropFolder) {
    throw new KalturaAPIException(KalturaDropFolderErrors::DROP_FOLDER_ALREADY_EXISTS, $dropFolder->path);
  }
}

Just commenting the lines solved the issue and the form could be saved. However, when testing ingestion of the file from the FTP drop folder to the Kaltura server we ran into another problem, described in the second part.

Leave a Reply

Your email address will not be published. Required fields are marked *