the downloads table on project nodes (http://drupal.org/node/89539) is broken on sites where:

a) cvs.module isn't enabled
b) users create release nodes and don't attach files (the file upload isn't a required field)
c) releases are published by default.

none of these conditions are particularly rare. project_release_table() should be smarter about the case where file_path is still NULL and do something more reasonable in that case (e.g. print "n/a" for the date and size, and not include a Download link).

Comments

aclight’s picture

Version: 4.7.x-2.x-dev » 5.x-1.x-dev
Assigned: Unassigned » aclight

this happens in 5.x-dev version also. I'm working on a patch for this.

AC

aclight’s picture

StatusFileSize
new1.52 KB

Here's a patch that fixes the problem. It checks to see if $release->file_path has a value, and if not it doesn't create a link for downloads and returns 'n/a' for both the size and date.

aclight’s picture

Status: Active » Needs review
StatusFileSize
new1.29 KB

Here's a screenshot of how the download table looks now. I'm not wild about the lack of alignment, but I'm not sure what the best way to get around that is. We could have the "Download" text there but not have it be linked, but I think that could be confusing. This can probably be fixed in CSS, but I'm not sure how to do that. Any other ideas?

AC

bonzinip’s picture

The patch at http://drupal.org/node/152638 instead uses the node creation date, rather than "n/a", as the date if no file was uploaded.

dww’s picture

Status: Needs review » Needs work

Yeah, actually, there's things I like and don't like about each of your patches. ;) It'd be nice to have a single patch that was the best of both. Basically, http://drupal.org/files/issues/project.paolo_.diff, but without introducing E_ALL warnings and code style violations, and also getting the filesize right. ;)

Anyone care to re-roll?

aclight’s picture

Status: Needs work » Needs review
StatusFileSize
new2.44 KB

The attached patch uses the project_release node creation date as the date displayed on the release table if a file is not attached to the release. Otherwise, it does the same thing as my original patch.

dww’s picture

Excellent, that looks ideal. I'll give it a little testing soon and get this in. Thanks!

dww’s picture

Status: Needs review » Needs work

Dang, I broke this patch with a code-style cleanup commit. :( It's a pretty trivial re-roll, stay tuned.

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new2.54 KB
dww’s picture

Status: Needs review » Fixed

Yup, that's a winner, all right. ;) Tested heavily, committed to HEAD, backported and committed to DRUPAL-4-7--2. Thanks, everyone.

Anonymous’s picture

Status: Fixed » Closed (fixed)