Download_file single page broken

Permalink
Within the TinyMCE editor, none of the images I'm adding via the controls are working. When checking the urls within the editor, it's the download_file/view_inline/FID format, when it's added to the page, it's the files/####/####/####.jpg format.

When I manually go to the download_file/FID, I get the following error:
mysql error: [1048: Column 'fID' cannot be null] in EXECUTE("insert into DownloadStatistics (fID, fvID, uID, rcID) values (NULL, 0, 1, 0)")


http://collegiatecoins.com.planitapps.com/download_file/102...
http://collegiatecoins.com.planitapps.com/download_file/view_inline...

http://goo.gl/VF9Fi - Looking at the google results for this error, it looks like it might be affecting other people as well?

# concrete5 Version
5.4.1.1

# concrete5 Packages
Designer Content (1.0.1).

# concrete5 Overrides
blocks/faqs, blocks/page_list, blocks/autonav, single_pages/contact.php, single_pages/getting-started.php, themes/collegiate_coins

# Server Software
Apache/2.2.15 (Red Hat)

# Server API
apache2handler

# PHP Version
5.3.2

# PHP Extensions
apache2handler, apc, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, json, libxml, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, Reflection, session, shmop, SimpleXML, sockets, SPL, sqlite3, standard, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib.

# PHP Settings
apc.max_file_size - 1M
log_errors_max_len - 1024
max_execution_time - 5
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 90
memory_limit - 256M
post_max_size - 1G
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 1G
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 100000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

TimDix
 
TimDix replied on at Permalink Reply
TimDix
So I'm attempting to debug this, and I added the following method to download_file, view_inline_debug, so you can see it's not a permissions problem, and it looks like the mimeType contents is valid... when I view the .png directly, all is fine.

http://collegiatecoins.com.planitapps.com/files/2513/0650/1744/uscn...

http://collegiatecoins.com.planitapps.com/download_file/view_inline...

public function view_inline_debug($fID) {
      $file = File::getByID($fID);
      $fp = new Permissions($file);
      if (!$fp->canRead()) {
         die('Permission Denied');
         return false;
      }
      $mimeType = $file->getMimeType();
      $fc = Loader::helper('file');
      $contents = $fc->getContents($file->getPath());
      var_dump('mimetype:'.$mimeType);
      var_dump('contents:'.$contents);
      die();
      header("Content-type: $mimeType");
      echo $contents;
TimDix replied on at Permalink Best Answer Reply
TimDix
In my config/site_post.php file, was a single space after the closing
"?> "
, which apparently was just enough screw up a couple of things :p
dimunation replied on at Permalink Reply
I was experiencing similar issues with inline file / image display, particularly from within the content editor. Deleting a few stray line breaks at the end of the config/site.php file fixed it entirely..!