Invalid File Path When Importing Targets Error

We recently upgraded from Sugar 8.0.2 to 9.0.2. We have started to notice a new error when importing targets. Whenever you change the field mapping during the import the screen turns white after clicking import targets. We checked our error logs and found the message below. Does anyone know of a permanent solution for this? In the mean time we are just fixing the import file headings to they map automatically when importing.

Sugar Version: Professional 9.0.2

Exception in Controller: Sugarcrm\Sugarcrm\Security\InputValidation\Exception\ViolationException: Invalid file path in /var/www/html/sugar/modules/Import/sources/ImportFile.php:103
Stack trace:
#0 /var/www/html/sugar/modules/Import/views/view.last.php(157): ImportFile->__construct('upload://import...', ',', '"', false, false)
#1 /var/www/html/sugar/modules/Import/views/view.last.php(114): ImportViewLast->getListViewTableFromFile('upload://import...', 'dup')
#2 /var/www/html/sugar/include/MVC/View/SugarView.php(153): ImportViewLast->display(Array)
#3 /var/www/html/sugar/include/MVC/Controller/SugarController.php(350): SugarView->process(Array)
#4 /var/www/html/sugar/include/MVC/Controller/SugarController.php(298): SugarController->processView()
#5 /var/www/html/sugar/include/MVC/SugarApplication.php(199): SugarController->execute()
#6 /var/www/html/sugar/index.php(27): SugarApplication->execute()
#7 {main}

Thanks,

Dan

Parents Reply
  • HiChris Raffle,

    So I was able to get around the error by comparing the code in the modules\Import\sources\ImportFile.php in Sugar versions 9.0.2 and 8.0.2.

    In the 9.0.2 version there was additional code added on line 94:

    $uploadDir = UploadStream::getDir();
    $uploadPath = UploadStream::path($filename);
    if (null === $uploadPath) {
    return false;
    }
    $fileConstraint = new File(['baseDirs' => [realpath($uploadDir)]]);
    $violations = Validator::getService()->validate($uploadPath, $fileConstraint);

    if ($violations->count()) {
    throw new ViolationException('Invalid file path', $violations);

    By commenting this code out, the import process worked. This should help point me in the right direction as the ImportFile.php references where my file must be breaking in one of these 3 places:

    use Sugarcrm\Sugarcrm\Security\Validator\Validator;
    use Sugarcrm\Sugarcrm\Security\Validator\Constraints\File;
    use Sugarcrm\Sugarcrm\Security\InputValidation\Exception\ViolationException;

    Thanks,

    Dan

Children
No Data