[drupal-devel] [bug] upload.module bug preventing file download
ejort
drupal-devel at drupal.org
Fri May 13 04:16:03 UTC 2005
Issue status update for http://drupal.org/node/22723
Project: Drupal
Version: 4.6.0
Component: upload.module
Category: bug reports
Priority: critical
Assigned to: Anonymous
Reported by: ejort
Updated by: ejort
Status: patch
Attachment: http://drupal.org/files/issues/upload.module.from_FROM.patch (910 bytes)
Hi,
I've just released a new site which has nodes only accessible by
authenticated users. These nodes also have attached files via
upload.module. I struck a problem where users were unable to download
these files due to a bug in upload.module, instead they received 'page
not found', with the following error output:
"user error: Unknown table 'na' in where clause
query: SELECT DISTINCT(f.nid), f.* from cms_files f WHERE
(na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN
('all0','term_access2','term_access6')) AND filepath =
'files/20050307_minutes.doc' in
/srv/www/htdocs/docs_renegades/www/includes/database.mysql.inc on line
66.
"
The problem was that the node_db_rewrite_sql() WHERE statement was
being inserted, but not the corresponding JOIN statement (where 'na' is
declared as an alias of {node_access}).
Looking through the code it seems this is because the regex in the
db_rewrite_sql() function is looking for 'FROM' (all caps), whereas the
upload.module query sent to db_rewrite_sql has 'from' (lower case).
Changing from -> FROM fixes the problem.
This patch should apply to 4.6.0 and cvs, though I didn't look to see
if the cvs version of db_rewrite_sql() still looks for an uppercase
FROM.
Cheers,
Eric
ejort
More information about the drupal-devel
mailing list