Add items from local server not working

mgrant
mgrant's picture

Joined: 2004-08-17
Posts: 100
Posted: Fri, 2004-09-17 19:53

When attempting to add items from local server I get the following error:

Quote:
The directory you entered is illegal. It must be a sub directory of one of the directories listed below

In my case I'm attempting to "find files" in C:\Pictures. This has been added as a "Legal Directory".

When I look through the debug output I see (along with a lot of other stuff) the following:

file_exists(c:\gallery2\modules\core/ItemAddFromBrowser.inc)
file_exists(c:\gallery2\modules\core/ItemAddFromWeb.inc)
file_exists(c:\gallery2\modules\remote/ItemAddGalleryRemote.inc)
file_exists(c:\gallery2\modules\uploadapplet/ItemAddUploadApplet.inc)
realpath(c:\pictures)
file_exists(c:\Pictures)
is_readable(c:\Pictures)
realpath(c:\Pictures)
realpath(\c:)
realpath(\c:\Pictures)

It looks to me like somewhere the path is being prepended with a backslash which causes it to fail.

Thanks,

-mg

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-09-17 20:56

ha, good catch. my guess is since the path doesn't start with a / or \ it thinks it's a relative path so it sticks a \ on the front.. need to check for drive letter case too.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-09-17 22:53

I think the illegal dir error occurs because you didn't match case.. "c:" vs "C:" ? Hmm, do we need a fix for this?

But the realpath calls with leading \ come from a different bit of code, in ItemAddFromServer.inc.
mgrant, what do you get from this php code on your system?<?php print dirname("C:\\Pictures") . "<br/>\n" . dirname("C:\\"); ?>

 
mgrant
mgrant's picture

Joined: 2004-08-17
Posts: 100
Posted: Sat, 2004-09-18 00:44

mindless,

Quote:
C:\
C:\

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sat, 2004-09-18 00:56

Cool, thanks. I updated the logic there, so I think it should recognize "C:\" as the "root" dir and not try to put "\" on the front. Update in a few hours and see how it looks. I didn't fix the case-sensitivity thing yet.

 
mgrant
mgrant's picture

Joined: 2004-08-17
Posts: 100
Posted: Sat, 2004-09-18 01:22

mindless,

I just updated and I cannot duplicate the problem entirely. The leading backslash is still present but I can succesfully "Find Files" without an error and it returns a listing of the specified directory.

So, either I got your changes in my update and they did the trick or I was just doing something wrong earlier.

I can confirm that it IS case sensitive. If my legal directory is c:\pictures and I try to find files is C:\pictures it will fail. If, however, I have both listed as legal directories it will work (until I enter C:\Pictures or c:\PiCTuRes) ;-)

 
mgrant
mgrant's picture

Joined: 2004-08-17
Posts: 100
Posted: Sat, 2004-09-18 01:28

mindless,

One other thing to think about...

Local content might not always be on drive C so the updated logic should take into acount ANY valid drive letter.

You know - life would be a lot easier if I'd just give up and switch to linux already.

Thanks,

-mg

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2004-09-18 04:49
mgrant wrote:
You know - life would be a lot easier if I'd just give up and switch to linux already.

Yeah but then we wouldn't be getting the benefit of all the time that you're spending helping improve G2 on IIS :-) There are a lot of people out there who will appreciate you for your efforts!

 
mgrant
mgrant's picture

Joined: 2004-08-17
Posts: 100
Posted: Mon, 2004-09-20 21:55
mindless wrote:
Cool, thanks. I updated the logic there, so I think it should recognize "C:\" as the "root" dir and not try to put "\" on the front. Update in a few hours and see how it looks. I didn't fix the case-sensitivity thing yet.

I've tried every variation I can think of and they're all handled properly. Case sensitivity doesn't appear to be a problem any more. I even tried:

C:\Denied\..\Allowed

And this worked. I've not yet tested with drive letters other than C: but I will shortly and I'll let you know if it doesn't work.

Thanks for the great work you're doing.

-mg

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2004-09-20 22:15

cool, thanks for testing.. yes, I did fix the case-sensitivity thing the other day. Unix platform is still case-sensitive, of course..