Hi

I have put / as the default folder (I am guessing this means the files folder, even though it's bit cloudy.:)

I see the sub folders when I start IMCE in text-only content page (no WYSIWIG editor). But I can't navigate them. Then I select a sub folder from the drop down menu, the pop-up windows reloads and "thinks" but ends up in the files folder where I started.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ufku’s picture

yes "/" means your files directory.
your bug report is what a bug report shouldn't be :)
isn't there any specific point you want to share?
tested with different browsers? with any starting folder other than main folder? with a different user?
see any javascript errors? created folders with sub-folder tool?...

Boletus’s picture

Tested with Opera 9.01, Firefox 2.01 and IE 6. Windows XP sp2.
No javascript errors as I can see.
I've tried to enter a subfolder in the settings. It works, but I can't navigate upwards.
I have not created the subfolders in the IMCE settings. Could that be a factor?

ufku’s picture

FileSize
744 bytes

manually created directories could be problematic but the error wouldnt be silent. i think there is a problem with that cloudy slash situation.
please try the patch that handles it in a more correct way.

Boletus’s picture

I'm not that good with patches. Could you talk me through it? At what line should I change the code?

Boletus’s picture

I added the line, as below. And commented out the original line. Is that correct?

//$dir = file_directory_path().'/'.$set['shared'];
  $dir = file_directory_path().($set['shared']=='/' ? '' : '/'.$set['shared']);

I still can't navigate sub-menus. Am I supposed to change anything in the IMCE settings?

ufku’s picture

yes it removes the extra // from the end of the directory name. the slashes are harmless in general but i thought yours was a special case. i was wrong.
can you send me the html sources of your main imce pages when you set the folder to / and when you set the folder to any subdirectory.
in the meantime you can check if there is any difference when you change your file download method(private-public switch) and when you login with a different user whose main folder is /.

Boletus’s picture

Sorry, I forgot to subscribe to this issue. I did not see your answer until now. I'll send you the code as soon as I can.

Boletus’s picture

I been up to my neck in work. Sorry. I moved my drupal installation from a subfolder www.example.com/drupal/ to www.example.com. Now the subfolder navigation IMCE works. I don't know if that is a clue or not?

Boletus’s picture

By the way, I did not change any of the IMCE settings after I moved the site.

Can it have to do something with the Base URL (optional) in the settings.php file for the site? I didn't enable that URL.

ufku’s picture

FileSize
1.18 KB

subfolder installation was the key to the bug. yes you found it. IMCE used $_SERVER['DOCUMENT_ROOT'] variable to get the relative file path, which results in an incorrect path with a sufolder installation. Now the relative path is obtained using the script path.
I'll commit the attached patch if you confirm the problem is over.
(Patch replaces line 787 with $root = str_replace('\\', '/', ($root ? realpath($root) : dirname($_SERVER['SCRIPT_FILENAME'])));)

ufku’s picture

Status: Active » Needs review
ufku’s picture

FileSize
1.16 KB

added missing realpath.

ufku’s picture

Status: Needs review » Fixed

commited.

Anonymous’s picture

Status: Fixed » Closed (fixed)