Hi all,

an Italian user has reported an incident with the SaveDataToFile function, 
contained in the module UCB of the "Tools" library

He invoked the function with a wrong file URL (an existing folder instead of a 
textfile)

This caused the deletion of the whole folder.
This problem is due to the first lines of the function:

        [......]
        oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
        oOutputStream = createUnoService("com.sun.star.io.TextOutputStream")
        If oUcb.Exists(FilePath) Then
                oUcb.Kill(FilePath)
        End If
        [......]

As you can see the code does not check if the URL passed is a directory.
This can be very dangerous and IMHO the code should be modified to check also 
the (not) isFolder condition.

demo code:

REM the URL passed must be an existing folder with rw access
REM BE CAREFULL!!! the folder will be deleted, no UNDO possible

sub test
        BasicLibraries.LoadLibrary("Tools")
        SaveDataToFile("file:///home/paolo/test/", Array("a", "b", "c"))
end sub


Thank you 
Paolo Mantovani

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to