I want to offer an integrated file browsing, and the Filebrowser Module is quite exactly what I search, but I still don't get it to work as expected. I created a filebrowser page, however most of the files in the directory are not visible.

The only thing I can think of interacting with other modules is either i18n (I use path prefix) but this shouldn't be a problem, or maybe it doesn't work because of the Clean Urls.. However even then the module should be able to parse the directories correctly, and the funny thing is if you enter a directory which doesn't exist in the filebrowser you still can access it manually...

This is how it looks like:
http://apophis.ch/node/79

This is how it should look like:
http://download.apophis.ch/

I was a bit suspicious at first, because there are no bug reports like this, and this problem exists since at least 6 months, but still I cannot think of a normal problem anymore... The settings are normal, I havent't even touched the "blacklist"

But I activated recursion and private downloads (which don't change the behavior anyway)

BTW: There should be a notice that Private downloads have to be enabled when using an absolute Path ;)

Comments

kong’s picture

StatusFileSize
new13.68 KB
new9.03 KB

I am having the same issue but it only happens with files named in Thai language -- I mean, Filebrowser displays all files but the ones that contain Thai character.

I'm running Drupal 6.6 using XAMPP on Windows XP

Please see screenshots in attachments.

Susurrus’s picture

This is probably an issue with unicode characters, as it looks like the only ones showing are the only ASCII-using files. I'm not sure what the cause would be code-wise, but first guess that's what it is.

Yoran’s picture

No news ? Is this still the case ?

kong’s picture

Hi,

In my case, it seems Apache/PHP doesn't play well with Windows' file system encoding. So I moved my Drupal installation to a Linux server (Ubuntu, to be specific) and the problem was gone.

apophis.ch’s picture

Title: Missing Files » Missing Files ( warning at line 538 )

Well I updated to rc8 tonight and now its not working at all, when you click the link above

First I though I did something wrong with the update.php so I checked the DB, but afaik it looks fine to me. (that my dump of filebrowser)

CREATE TABLE IF NOT EXISTS `filebrowser` (
`file_path` varchar(255) NOT NULL,
`explore_subdirs` tinyint(4) NOT NULL,
`nid` int(10) unsigned NOT NULL,
`private_downloads` tinyint(3) unsigned NOT NULL default '0',
`hidden_files` varchar(255) NOT NULL default '',
`filtered_files` varchar(255) NOT NULL default '',
`allowed_uploaded_files` varchar(255) NOT NULL default '',
`hide_extension` tinyint(4) NOT NULL default '0',
`visible_columns` varchar(255) NOT NULL default '',
PRIMARY KEY (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `filebrowser`
--

INSERT INTO `filebrowser` (`file_path`, `explore_subdirs`, `nid`, `private_downloads`, `hidden_files`, `filtered_files`, `allowed_uploaded_files`, `hide_extension`, `visible_columns`) VALUES
('/var/www/download', 1, 79, 1, '.*\r\ndescript.ion\r\nfile.bbs\r\nCVS', '', '', 0, 'a:4:{s:4:"size";s:4:"size";s:8:"modified";s:8:"modified";s:7:"created";i:0;s:4:"type";i:0;}');

---

So I looked at Error (warning: Invalid argument supplied for foreach() in /var/www/apophis-neXt/sites/all/modules/filebrowser/filebrowser.module on line 538.)

which is the following line: foreach ($node->file_listing as $file) {

So it probably protests because there is no data at all to be displayed. The Problem that there is no file at all is probably somewhere else. However I have no idea why it is doing this to me!

I also tried to delete the filebrowser module directory and add it again, the error is still the same.

Before you ask, www-data has the rights to access the files in /var/www/download , as you see apache can serve them on download.apophis.ch! I even tried to change it, nothing changed there!

should there be an admin page for settings? ;) can someone provide me the name of it? I dont find it in the adminstration menu, even when I sort by module, the only option it gives me is the permissions Settings.

Yoran’s picture

Well I'll have to test on windows. I didn't played with this OS for ages

Yoran’s picture

What OS are you using exactly ?

apophis.ch’s picture

Thats a simple debian (etch updated to lenny, apache2)

apophis.ch’s picture

Well I updated to rc9 today, and its still:

warning: Invalid argument supplied for foreach() in /var/www/apophis-neXt/sites/all/modules/filebrowser/filebrowser.module on line 580.

Here -> http://apophis.ch/node/79

The path shows to this directory the internal directory /var/www/download/ which is here -> http://download.apophis.ch/

nothing changed

apophis.ch’s picture

OK what I found out:

in the function _filebrowser_load_files, at the end of that function I have the $files array with all the files which should be in there...

tehre that happens:

$cache[$relative_path]= & $files;
$node->file_listing= $files;

I did a print_r($node->file_listing), and all the files were in there...

when the fuction came to:

function theme_filebrowser_dir_listing(& $node) {
drupal_add_js(drupal_get_path("module", "filebrowser")."/filebrowser.js");

$files= & $node->file_listing;
// Manage empty folder
if (empty ($files)) {
return '

'.t('This directory is empty.').'

';
}

it seems that print_r($node->file_listing); is empty!!! But why? and why nobody else is experiencing it...
Thats also the reason why the warning comes, because $node->file_listing is null.

kong’s picture

@apophis.ch:

Don't know if your case is the same as mine.

I used to get an empty directory listing and spent hours tried to figure out what happened.

It ends up that I had a custom template file named filebrowser-dir-listing.tpl.php
in the current theme directory. I didn't remember when I created it, though.

This may or may not be the case for you, just want to let you know what I found out.

apophis.ch’s picture

No I use a standard Garland Theme, and I didnt touch any files from the theme or the filebrowser plugin (beside the debugging effort above)

The really strange thing is I save the array to a dummy global variable which ended up empty aswell... (very strange)

But the fact is, the files get into the $files variable, but when the rendering happens the variable isn't set anymore.

Anders Östberg’s picture

Title: Missing Files ( warning at line 538 ) » Missing Files ( warning at line 580 )
Version: 6.x-2.0-rc5 » 6.x-2.0-rc9

I have the same problem, I get the warning and "This directory is empty" no matter what I try.
Has anyone found a solution?
(I'm on Windows).

AliceInWonderland-1’s picture

StatusFileSize
new329 bytes

Hi @all,

In the case that the data is read from cache (at line 179 in filebrowser.module) the $files array is returned instead of stored in $node->file_listing.

The patch fixes the problem.

if (isset ($cache[$relative_path])) {
-    return $cache[$relative_path];
+    $node->file_listing = $cache[$relative_path];
}
Anders Östberg’s picture

Thanks!
It now sort of works though that immediately revealed a couple of other problems ... which should go into separate bug reports I guess.

Yoran’s picture

@AliceInWonderland Thank you for the patch, this will be applied in RC10

Yoran’s picture

Status: Active » Patch (to be ported)
Yoran’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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