All folder listings are lost after upgrading to 6.x-2.0-rc12. I've been running update.php, as usual.

The files still exist in teh filesystem (even if I never understood where this module puts what)

Greetings, -asb

Comments

asb’s picture

Addition: The "Metadata" tab still lists the (sub-) directories.

The files in the "audio" directory are owned by the webserver user.

Also, there is a descript.ion file in each subdirectory, but it's contents is not evaluated by the "Metadata" tab (the metadata textfields are empty).

clivesj’s picture

Do you mean that nothing is listed?
I had the same thing, but it appeared i had to re-configure the folder options.
So enable the checkboxes and your listings should appear again.

asb’s picture

Thanks, switching to "icon view", then saving, then switching back to "llist view" does the trick.

Now the previously uploaded files are listed again. But I'm getting the following warning:

warning: usort() [function.usort]: Invalid comparison function in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc on line 201.
warning: usort() [function.usort]: Invalid comparison function in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc on line 205.

Probably this causes that sorting by Display name does not work. Edit: #841372: usort() Invalid comparison function - Upgrading to dev version.

Also, the texts from the descript.ion files still do not appear in the "Metadata" tab (not sure if they should).

And, last but not least, the listed files can not be downloaded (404, file not found error).

Thanks & greetings, -asb

asb’s picture

Version: 6.x-2.0-rc12 » 6.x-2.x-dev

6.x-2.x-dev deliver additional errors:

Parse error: syntax error, unexpected '}' in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc(218) : runtime-created function on line 1
Parse error: syntax error, unexpected '}' in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc(223) : runtime-created function on line 1

The "Display name" error is nox fixed in the dev version.

Also, it breaks the theme. Great.

Yoran’s picture

What is the field you are sorting (in the URL sort parameter) ?
Which php version are you using ?
Is it possible for you to insert an "error_log($code)" just before the erroneous line and giving to me what you have ?

Anyway sorry if I have brake things, I'll try to fix as soon as I can.

About where i'm storing information, well, this is an original drupal design problem that no one want to care about :) Modules can store settings or content just in any place they want... Each developer got his strategy where we should have a real storage api. anyway, all information are stored in 2 tables :
- node_dir_listing that is associated with drupal node table and contain all per node settings. Actually my strategy is just to have 2 plain fields (nid et folder_path) and a blob containing all serialized information.
- node_dir_listing_content which contains a mirror of all files/folders found in node. I had to create and maintain this table in order to solve many encoding problems.

asb’s picture

> What is the field you are sorting (in the URL sort parameter) ?

http://.../node/218?sort=desc&order=Display+name

> Which php version are you using ?

PHP 5.2.6-1+lenny8

Magic quotes GPC	Off
Magic quotes runtime	Off
Max execution time	30
Max input time	60
Memory limit	200M
Post max size	30M
Register globals	Off
Safe mode	Off
Session cache limiter	none
Session save handler	user
Upload max filesize	30M

PHP extensionscURL version	7.18.2
GD version	2.0 or higher
FreeType support	Enabled
JPG support	Enabled
PNG support	Enabled
Multibyte support	Enabled
XML support	Enabled
Zip support	Enabled
Zlib support	Enabled

> Is it possible for you to insert an "error_log($code)" just before the erroneous line and giving to me what you have ?

The error was:

Parse error: syntax error, unexpected '}' in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc(218) : runtime-created function on line 1
Parse error: syntax error, unexpected '}' in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc(223) : runtime-created function on line 1

If 218 and 223 are the line numbers, I'm getting this after inserting error_log($code) at the two locations referenced:

Parse error: syntax error, unexpected T_VARIABLE in /var/www/drupal/sites/all/modules/filebrowser/filebrowser.theme.inc on line 219

Inserting error_log($code) before line 1 makes no sense because line 1 is: <?php.

Regarding storing the data: I'm putting the files into /audio (in the root of the Drupal installation); however, there's also a directory at ./sites/default/files/filebrowser that I haven't created (with two subdirectories: archives and obscurity_links). I have no idea what archives is, and I can't find a setting to configure/remove these obscurity_links in the current -dev release. This is a bit confusing but no major issue (some documentation what to expect would help)

Thanks & greetings, -asb

asb’s picture

Title: Folder listings are lost after upgrading » File downloads inaccessible after upgrading, various error messages
Priority: Normal » Critical

Changing description and status (the module does not work at all in the current state)

asb’s picture

Any updates on this issue?

verta’s picture

I am seeing this error in beta 12, on a folder with an underscore in the name, not spaces:

* warning: usort() [function.usort]: Invalid comparison function in []sites\all\modules\filebrowser\filebrowser.theme.inc on line 201.
* warning: usort() [function.usort]: Invalid comparison function in []sites\all\modules\filebrowser\filebrowser.theme.inc on line 205.

#841372: usort() Invalid comparison function is also discussing this.

Yoran’s picture

Status: Active » Fixed

Normally this is fixed in last dev

asb’s picture

Status: Fixed » Active

Sorry, in filebrowser 6.x-2.x-dev from 2010-Sep-07 this issue isn't fixed completely.

E.g. downloads are still completely impossible.

As well if the file includes whitespace characters which aren't handled at all, as it seems, as with filenames like "saudade_cd_2nd-cut_14.mp3" (watchdog logs: "file not found", but the path is correct).

As far as I can see, the latest dev release isn't operational at all, except that it creates directory listings (which can't be used for anything since downloads are impossible).

Yoran’s picture

Are you sure you are using the right download manager ("private" if you folder in under drupal root, "public" else case ? ).

asb’s picture

> Are you sure you are using the right download manager ("private" if you folder in under drupal root, "public" else case ? ).

Yes, the "downloads" folder is under Drupal root. And no, I wasn't aware that the "private" download method would be a requirement. I've changed this, but the behaviour doesn't change.

Yoran’s picture

Oh god, I should get some sleep before answering, sorry.

private - You chose this when your files can be access by Apache but can't be accessed by a direct URL. This is typically the case when the folder used by a filebrowser node is outside drupal root (ex. /storage/download). But the target folder should be readable by Apache. So when filebrowser receive URL http://yousite/filebrowser/download/XXX, it will locate XXX as a file, and if PHP can access it, will read it and send it byte per byte to web client. So the file is served by PHP.

direct - You choose this when your files can be access trough a direct URL. This is typically the case when the folder used by a filebrowser node is outside drupal root (ex. sites/files/downloads). As private mode, files should be readable by Apache. So when filebrowser receive URL http://yousite/filebrowser/download/XXX, it will send to web client a Location header (redirect) in order to let Apache directly serve the file.

Ok that's for the theory :) Practically, I fixed a problem with direct download for people who was setting "inside drupal" root as a relative path to drupal root. So if you can give a try to the next dev version, set your download mode to "direct" (as your download folder is under drupal root) and tell me what's happen ?

asb’s picture

Thanks for the clarification. I upgraded to the current dev release, cleared all caches (through drush), but the behaviour didn't change.

Any other ideas?

greywolfsspirit’s picture

I didnt scroll up to check on this, but, by chance did you check your admin/settings/file-system, under download method? Is it set for public or private?

Download method:
Public - files are available using HTTP directly.
Private - files are transferred by Drupal.
Choose the Public download method unless you wish to enforce fine-grained access controls over file downloads. Changing the download method will modify all download paths and may cause unexpected problems on an existing site.

Yoran’s picture

The last test I can thing a about is can you download your file using a normal URL, meaning http://yoursite/path/to/your/file/yourfile ?

Something else that can be source of problem : did you check you have a table called node_dir_listing_content and can you find the file you try to download with the right path and nid in it ? when you found this file, the fid column value should be the same as XX in filebrowser/download/XXX link.

if it was a global download problem I imagine others should have it to. So if this test succeed, we can have a try at your configuration by telling us which OS your are using, wich PHP version, etc.

@greywolfsspirit well actually private/public mode don't change that much if your files are inside drupal root. First I tought as you do that drupal was kind of changing son .htaccess to block such download, but it seems not to :) But why not give this a try asb, using public mode for drupal AND filebrowser.

Osik’s picture

Hi Yoran, Hi asb,

I'm expecting the same behaviour like asb. In my drupal root folder I have a folder called docs. If I fetch, wget or what so ever the URL http://www.somesite.com/docs/myfile.ext there is no problem. The file is served by Lighttpd. If open the URL http://www.somesite.com/docs in my webbrowser I get the listing of all files in that docs folder. But trying to download gives me an 404. This seems to be happen, because the filebrowser module rewrites the url from http://www.somesite.com/docs/myfile.ext to http://www.somesite.com/filebrowser/download/XXX where XXX is an NodeID.

Setting the downloadtype to direct or private makes no difference.

Any help is appreciated.

asb’s picture

@Yoran: Yes, downloads circumventing the filebrowser mechanism do work fine. The OS is Debian "Lenny", the PHP version - well, would you please have a look at #6 from July 2, 2010?

> did you check you have a table called node_dir_listing_content ...

I have one table node_dir_listing_content and another one called node_dir_listing

mysql> describe node_dir_listing;
+-------------+------------------+------+-----+---------+-------+
| Field       | Type             | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+-------+
| nid         | int(10) unsigned | NO   | PRI | NULL    |       | 
| folder_path | varchar(255)     | NO   |     | NULL    |       | 
| properties  | longtext         | NO   |     | NULL    |       | 
+-------------+------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> describe node_dir_listing_content;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| nid   | int(10) unsigned | NO   | MUL | NULL    |                | 
| fid   | int(10) unsigned | NO   | PRI | NULL    | auto_increment | 
| root  | varchar(255)     | NO   |     | NULL    |                | 
| path  | varchar(255)     | NO   |     | NULL    |                | 
+-------+------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

The first one indeed contains the data from the filebrowser listing; sample excerpt:

mysql> select * from node_dir_listing_content;
+-----+-----+---------------------+----------------------------------------------------------------+
| nid | fid | root                | path                                                           |
+-----+-----+---------------------+----------------------------------------------------------------+
| 218 | 301 | /Saudade            | /Saudade/saudade_cd_2nd-cut_09.mp3                             | 
| 218 | 277 | /Saudade            | /Saudade                                                       | 
| 218 | 275 | /                   | /Saudade                                                       | 
| 218 | 274 | /                   | /                                                              | 
...
+-----+-----+---------------------+----------------------------------------------------------------+
38 rows in set (0.00 sec)

I never fully understood the mechanics of the Filebrowser module, but this looks strange to me: Two different file ids are pointing to the same "path", but are coming from a different "root". However, other directories have the same "structure" in this database table, so probably this is how it is supposed to be?

> and can you find the file you try to download with the right path and nid in it?
> when you found this file, the fid column value should be the same as XX in filebrowser/download/XXX link.

Sorry, the that part I do not understand. What would be the "right path"?

@Osik: I'm running Apache, so at least it's not an issue with those incomplete Lighty rewrite rules ;) you're still on FreeBSD?

Yoran’s picture

@asb nothitng difficult in this table. You have 2 ids for the same "file" because FID:275 means "Saudade folder in / folder" and FID:277 means "Saudade folder as a dot in Saudade folder".

When you fly over this mp3 file do you have /filebrowser/download/301 as this 301 is the FID for the file you need to download.

If this is correct, the last thing I see is a problem with the redirection from http://yoursite/filebrowser/download/301 to plain URL you checked. So tell me and I'll modify the way make dowload URL.

asb’s picture

If I'm hovering over the link on saudade_cd_2nd-cut_09.mp3 (physically stored in the folder /var/www/mysite/audio/Saudade) when being on http://mysite.tld/node/218/275, I'm getting the URL http://mysite.tld/filebrowser/download/301. The URL http://mysite.tld/filebrowser/download/301 results in a 404 "not found", while http://mysite.tld/audio/Saudade/saudade_cd_2nd-cut_09.mp3 immediately downloads the file.

Node node/218 is configured as follows:

  • The system file path to the directory: /var/www/aem/audio
  • Download manager: Direct download
  • Allow subdirectory listings (checked)
  • Folder Upload: (unchecked)
  • FileSystem encoding: UTF-8
Yoran’s picture

Oh yes, I think I have it... You use an absolute path instead of a relative one, for a apache served directory. "normally" if in your case drupal root is /var/www/aem, path definition should be just "audio". I made a patch for this, I hope next dev will fix your problem.

asb’s picture

Status: Active » Fixed

> You use an absolute path instead of a relative one, for a apache served directory.
> "normally" if in your case drupal root is /var/www/aem, path definition should be just "audio".

Hm, the description of this setting seems to be pretty clear: "The system file path to the directory. This can be an absolute path or should be relative to the Drupal root directory.. However, if I use a path relative to the Drupal root directory, downloads start to work. So correcting the description ("...must be a path relative to the Drupal root directory") would suffice, but a proper fix is even better, of course. Changing the status to "fixed".

Thank you!

Yoran’s picture

You're welcome :)

Normally my fix handle absolute path with public download now. So the description should be ok like that :)

the fatness’s picture

Status: Fixed » Active

I previously posted this http://drupal.org/node/910218 and assumed all worked fine after restarting IIS.

I was wrong, just the error disappeared, now I am unable to download any files. The listing appears, but I am unable to download anything it just sends me back to when any files are clicked.

I am able to access them directly mysite.com/d/files/file.ext where /d/ is my drupal install directory. I have it set for Public and my installation is as follows:

Windows Server 2003 / IIS 6.0
PHP 5.3.3
Drupal 6.19
Filebrowser 6.x-2.x-dev release date: 2010-Sep-11

the fatness’s picture

Status: Active » Closed (fixed)

after much troubleshooting, and setting it to private it works. no clear steps on what i did, restarted server, and IIS a few times changed all settings within.

asb’s picture

Status: Closed (fixed) » Active

Re #23 - I had filebrowser-6.x-2.x-dev from 2010-Sep-19 running for a while with a relative path (relative to Drupal's root on the webserver). As reported in September, this worked.

Without changing the configuration, it suddenly stopped working again. The behaviour went back exactly to the status described in #11 (no files can be downloaded because of "file not found" errors).

Next I changed the "system file path to the directory" from relative to absolute (this is the configuration that used to not work). Now files can be downloaded again, at least there are no "file not found errors" anymore at the moment. I absolutely don't understand what is happening here.

Furthermore, when clicking on an audio file, the file is not being downloaded by default, but a audio player opens in the web browser; I believe that the "Filebrowser" module serves a wrong mime type.

Last but not least, the audio file is not being played, but the browser stopps responding (checked with Opera and Chromium under Ubuntu "Maverick"). Windows users could do a right mouse click on the file and choose "Save as", however this doesn't work for Apple users.

Reopening.

Nicolas Georget’s picture

when clicking on an audio file, the file is not being downloaded by default, but a audio player opens in the web browser;

Not from a wrong mime type. It comes from a wrong header option called on the function filebrowser_filebrowser_download_manager_process() in the file filebrowser.module (line 909 and 912):

header('Content-Disposition: inline; filename="' . mb_convert_encoding(_filebrowser_safe_basename($filename), "ISO-8859-2", "UTF-8") . '";');
[...]
header('Content-Disposition: inline; filename="' . _filebrowser_safe_basename($filename) . '";');

Change header('Content-Disposition: inline attachment; and same for line 912. (i.e. #924856: File as Attachment or Inline)

In the filebrowser-6.x-2.x-dev from 2010-Sep-19 version, there's another bug that truncates file name : http://drupal.org/node/924812#comment-3501576

Finally, there are big confusing codes about the Direct/Private download options #924988: Zip Archive created and download it but i have to let Yoran explain to us.
Btw Yoran if you hear this, there are a lot of bug reports that could be duplicated ;-)

Yoran’s picture

Status: Active » Postponed (maintainer needs more info)

Btw Yoran if you hear this, there are a lot of bug reports that could be duplicated ;-)

Oh yes I know, I have so little time to maintain this module, I let you imagines for duplicated issues ;-)

About this story of direct/private download, asb, if you still have the problem, can you give a try to the rc13 (oh god..) I'll try to create tonight (as soon as I understood how to do this with git ;-)

Yoran’s picture

Status: Postponed (maintainer needs more info) » Fixed

No news good news ?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.