chrisroberts/dav4rack — pull request #54 by pifleo (2013-01-08 12:24:12+00:00)
Title: FileResourceLock#unlock_token nil root path and variable not defined

Hi,

I'm still trying to implement webdav in my app.

When testing lock and unlock with Office I had the following error:
` TypeError: can't convert nil into String` in `file_resource_lock.rb:80:in join`
after some research I found that `root` is not passed to `#find_by_token` in `FileResource#unlock` [line:262](https://github.com/chrisroberts/dav4rack/blob/master/lib/dav4rack/resources/file_resource.rb#L262).

Long to find, easy to patch.
But then `#unlock` as an undefined variable `tok`, I supposed it was `struct`.

And finally, its need a little more investigation, but MS Word remove the first and last characters of the token when calling `unlock` then the store never find any token.
I give a look at what is send to the webdav client and the token seem ok. I don't know enough about webdav and have no clue where to look, maybe Word misinterpret the xml sent or just want to be upsetting.
I made a monkey patch to find the good token.

MS Word generate a lot of lock request and fill the token table for the loaded file. Maybe the destroy action should clean all tokens for a given file.