Index: branches/5.3.x/units/downloads/download_helper.php =================================================================== diff -u -N -r15671 -r15695 --- branches/5.3.x/units/downloads/download_helper.php (.../download_helper.php) (revision 15671) +++ branches/5.3.x/units/downloads/download_helper.php (.../download_helper.php) (revision 15695) @@ -1,6 +1,6 @@ Application->recallObject('file', null, Array('skip_autoload' => true)); /* @var $file_object kDBItem */ - $sql = $file_id ? - 'SELECT FileId, FilePath, RealPath, MIMEType FROM '.$this->Application->getUnitOption('file', 'TableName').' - WHERE FileId = '.$file_id : - 'SELECT FileId, FilePath, RealPath, MIMEType FROM '.$this->Application->getUnitOption('file', 'TableName').' - WHERE ProductId = '.$product_id.' AND IsPrimary = 1'; + if ( $file_id ) { + $sql = 'SELECT FileId, FilePath, RealPath, MIMEType + FROM ' . $this->Application->getUnitConfig('file')->getTableName() . ' + WHERE FileId = ' . $file_id; + } + else { + $sql = 'SELECT FileId, FilePath, RealPath, MIMEType + FROM ' . $this->Application->getUnitConfig('file')->getTableName() . ' + WHERE ProductId = ' . $product_id . ' AND IsPrimary = 1'; + } + $file_info = $this->Conn->GetRow($sql); $field_options = $file_object->GetFieldOptions('RealPath');