PDA

View Full Version : File/dir names with spaces


Stardog
10-04-2003, 04:15 PM
Since beta 5, my postdel has not worked with filenames with spaces in it. I checked the arguments coming from ioFTPD (from post dele event) and it appears that its not getting the full filename from io.

ADDiCT
10-04-2003, 04:33 PM
commandline = DELE desert combat v03.zip
PATH=d:\ioFTPD\site\crap\test

filename is "d:\ioFTPD\site\crap\test\desert combat v03.zip"

?

darkone
10-04-2003, 08:11 PM
Originally posted by StarDog
Since beta 5, my postdel has not worked with filenames with spaces in it. I checked the arguments coming from ioFTPD (from post dele event) and it appears that its not getting the full filename from io.

I need more details... what arguments it gets, and so on :)

Mouton
10-05-2003, 08:56 AM
Seems to work ok here (5.1.5):

[09:55:48] DELE Site Kill test spaces.txt
[09:55:48] Current dir is D:\ioFTPD\scripts
[09:55:48] ====================
[09:55:48] # of arguments: 7
[09:55:48] [0] = ..\scripts\ioBanana.exe
[09:55:48] [1] = zsdel
[09:55:48] [2] = DELE
[09:55:48] [3] = Site
[09:55:49] [4] = Kill
[09:55:49] [5] = test
[09:55:49] [6] = spaces.txt
[09:55:49] ====================
[09:55:49] ioBanana Process Time: 180 ms
[09:55:49] exit: 0
[09:55:49] 250 DELE command successful.

I just echo the args I receive when ioB starts.

fr0z3n
10-05-2003, 12:20 PM
hey,
while we're on the subject, the way arguments are passed by ioftpd:

some.exe <realpath> <CRC> <virtual path>

well if either of these have spaces in them you can't determine which is which , so i was wondering if you could make a quick fix and surround the arg's with " ", therefore forcing it to be exactly one argument.

hope you take this into consideration :)

laters ,
fr0z3n

Stardog
10-05-2003, 01:20 PM
Originally posted by Mouton
Seems to work ok here (5.1.5):

[09:55:48] DELE Site Kill test spaces.txt
[09:55:48] Current dir is D:\ioFTPD\scripts
[09:55:48] ====================
[09:55:48] # of arguments: 7
[09:55:48] [0] = ..\scripts\ioBanana.exe
[09:55:48] [1] = zsdel
[09:55:48] [2] = DELE
[09:55:48] [3] = Site
[09:55:49] [4] = Kill
[09:55:49] [5] = test
[09:55:49] [6] = spaces.txt
[09:55:49] ====================
[09:55:49] ioBanana Process Time: 180 ms
[09:55:49] exit: 0
[09:55:49] 250 DELE command successful.

I just echo the args I receive when ioB starts.

Thats the problem right there, each part of your filename is an argument! you should have 4 args(..\scripts\ioBanana.exe, zsdel, DELE, and "Site Kill test spaces.txt")

Mouton
10-05-2003, 08:07 PM
Welcome to the world of ioftpd script...
same happen OnUploadComplete, etc.
all filenames with spaces are passed without double-quotes, as fr0z3n pointed out... so until dark fixes that, u'll have to concatenate all args to make your filename...

you can use regexp for OnUploadComplete to get all 3 arguments correctly...
Not that easy, but only way i found to make it work.

darkone
10-05-2003, 09:08 PM
OnUploadComplete has quotes, only PRE/POST events don't.. as daemon has no clue what arguments they contain (which argument is filename & which is parameter)

OnUploadComplete/Error/DownloadComplete/Error argument formatting from sources:

wsprintf(szArgs, "\"%s\" %08X \"%s\"", szFileName, ~lpData->u32Crc, lpData->File.pwd);

fr0z3n
10-05-2003, 09:50 PM
Originally posted by darkone
OnUploadComplete has quotes, only PRE/POST events don't.. as daemon has no clue what arguments they contain (which argument is filename & which is parameter)

OnUploadComplete/Error/DownloadComplete/Error argument formatting from sources:

wsprintf(szArgs, "\"%s\" %08X \"%s\"", szFileName, ~lpData->u32Crc, lpData->File.pwd);

hey,

was that added recently? because when I was testing on 4.9.4u i didn't see that, each space was considered a seperate argument :confused:

fr0z3n

Mouton
10-06-2003, 08:40 AM
Indeed. That has been fixed.

[09:38:55] STOR TOMB RAIDER SAVES.zip
[09:38:57] Current dir is D:\ioFTPD\scripts
[09:38:57] ====================
[09:38:57] # of arguments: 6
[09:38:57] [0] = ..\scripts\ioBanana.exe
[09:38:57] [1] = pre_stor
[09:38:57] [2] = STOR
[09:38:57] [3] = TOMB
[09:38:57] [4] = RAIDER
[09:38:57] [5] = SAVES.zip
[09:38:57] ====================

[09:38:58] 150 Opening BINARY mode data connection for TOMB RAIDER SAVES.zip.
[09:38:59] Transferred: TOMB RAIDER SAVES.zip 941 KB in 16:08:28 (0.02 KBps)
[09:38:59] 226-Current dir is D:\ioFTPD\scripts
[09:38:59] 226-====================
[09:38:59] 226-# of arguments: 5
[09:38:59] 226-[0] = ..\scripts\ioBanana.exe
[09:38:59] 226-[1] = upload
[09:38:59] 226-[2] = F:\Test\TOMB RAIDER SAVES.zip
[09:38:59] 226-[3] = 5822BBD0
[09:38:59] 226-[4] = /temp/TOMB RAIDER SAVES.zip
[09:38:59] 226-====================

fr0z3n
10-06-2003, 04:39 PM
awesome :D

thanks,
fr0z3n

Stardog
10-06-2003, 08:42 PM
Originally posted by fr0z3n
hey,

was that added recently? because when I was testing on 4.9.4u i didn't see that, each space was considered a seperate argument :confused:

fr0z3n

The OnUploadComplete event's always been like that. I could have sworn that the POST commands were like that too, but now that I think of it, I probably never verified that. No big deal, I can live with it like this..

Mouton
10-07-2003, 07:58 PM
eheheh
the OnUploadComplete event was changed to that very recently.

I had to make a regexp algo just to fix that thing when i developped ioB and was trying to make it compatible with filenames with spaces.

i'm 100% sure aboot that.

anyhow, it's fixed now. so cool. I'll get back to c++ builder now! :)