regression (default TEXT) by too long file urls causes watchdog errors
doq - November 19, 2006 - 22:11
| Project: | Drupal |
| Version: | 5.0-beta1 |
| Component: | watchdog.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | sammys |
| Status: | closed |
Description
First, when trying to access page - http://localhost/drupal/drupal-cvs/files/%C2%ED%F3%F2%F0%E8%20%EA%EE%EC%...
Warning: pg_query(): Query failed: ERROR: invalid UTF-8 byte sequence detected near byte 0xe2 in d:\highspeed\htdocs\drupal\drupal-cvs\includes\database.pgsql.inc on line 125
Warning: ERROR: invalid UTF-8 byte sequence detected near byte 0xe2 query: watchdog INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'page not found', 'files/������ ���������� - ���_0.jpg', 1, '', 'http://localhost/drupal/drupal-cvs/files/%C2%ED%F3%F2%F0%E8%20%EA%EE%EC%EF%FC%FE%F2%E5%F0%E0%20-%20%F4%EE%ED_0.jpg', '', '127.0.0.1', 1163969314) in d:\highspeed\htdocs\drupal\drupal-cvs\includes\database.pgsql.inc on line 144--------------------
Second, when trying to add new file with page larger then 128 or with cyryllics in filename.
--------------------
Third, can't add several files.
============
Tests are under Drupal 5.0 cvs, Postgre 8.1

#1
Second, when trying to add new file with path larger then 128 or with cyryllics in filename.
#2
You likely are using KOI8-R or some other non UTF-8 charset.
#3
@chx is correct about the character set. Check which character set you're using on the computer you're uploading from and ensure it's UTF-8.
Aside from that you've reported a bug with watchdog not being able to report URLs containing a large number of URL escaped chars in the filename. The filename essentially expands to 3 times longer. This is the concern.
There are only two ways around this:
@chx: what do you think?
--
Sammy Spets
Synerger
http://synerger.com
#4
I am not 100% but that error is triggered in somewhere deep in PHP, Drupal just traps it. I am not sure how could we change the URL... please advice. Writing a function which downloads a file given a fid should not be that hard, I attached the patch for that. The patch DOES NOT fix anything and SHOULD NOT be committed -- it's dead code at this moment.
#5
*grumble* clicked the wrong patch. too many upload issues one night :)
#6
Looks like it'll be too difficult to do suggestion 2 due to direct file access 404s invoking a watchdog() call. So the only solution is to convert the watchdog.location field to text. Attached is a patch and it's RTBC for PostgreSQL. Waiting for someone to confirm the update works for MySQL.
#7
#8
Committed to HEAD.
#9
MySQL does not support DEFAULT values on TEXT fields (see also http://drupal.org/node/54702).
#10
This patch introduces a DEFAULT value for a TEXT field, while we just took them all out.
#11
#12
Committed. Thanks.
#13