ramondeklein / nwebdav

.NET implementation of the WebDAV protocol
MIT License
155 stars 42 forks source link

Far and path contains # #11

Closed yar229 closed 7 years ago

yar229 commented 7 years ago

NetBox Far plugin cannot create folder with name, for example, "#123" If such folder already exists and you enter this one, all inner files and folders (include parent "..") looks like parent folder name.

But everything ok on, for example, webdav.yandex.ru Also it's ok when webdav server mapped as disk drive

Other clients (Total Commander, CarotDAV) works normally

ramondeklein commented 7 years ago

Hashes were interpreted as a fragment instead of part of the path. Should be fixed now.

yar229 commented 7 years ago

Now Far cannot see any files inside #directory

Used NWebDav.Sample.HttpListener v.0.1.22.0 Far v.3.0.4774, NetBox v.2.3.0.436 log.txt tc and far

ramondeklein commented 7 years ago

I hope I have nailed the issue now. It seems to work with FAR and WinSCP now. I had to make some low-level changes, so please test the current master branch. I will create new NuGet packages if this seems to be stable.

Hashes are kind-of special in URL's, so it's nasty that they are used in filenames. But end-user will do it, so we should be able to support it :-)

yar229 commented 7 years ago

Super-nice, thank you! Yep, it's nasty, but so goes the world :) Suppose to test it tomorrow/day after

yar229 commented 7 years ago

file names README - test.md, README test.md, README – test.md seems ok in common cases, but when located in #-dir looks like README%20-%20test.md, README%20%20%20test.md, README%20%E2%80%93%20test.md

Checked in Far, Total Commander and CarotDAV

[3]: PROPFIND:http://127.0.0.1:11111/#2:127.0.0.1:11111 - Start processing
[3]: <?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:Z="urn:schemas-microsoft-com:">
  <D:response>
    <D:href>http://127.0.0.1:11111/%232</D:href>
    <D:propstat>
      <D:prop>
        <D:creationdate>2017-02-01T20:02:25.992Z</D:creationdate>
        <D:displayname>#2</D:displayname>
        <D:getlastmodified>Wed, 08 Feb 2017 07:50:46 GMT</D:getlastmodified>
        <D:resourcetype>
          <D:collection />
        </D:resourcetype>
        <D:lockdiscovery />
        <D:supportedlock>
          <D:lockentry>
            <D:lockscope>
              <D:exclusive />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
          <D:lockentry>
            <D:lockscope>
              <D:shared />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
        </D:supportedlock>
        <D:childcount>3</D:childcount>
        <D:isfolder>1</D:isfolder>
        <D:ishidden>0</D:ishidden>
        <D:isstructureddocument>0</D:isstructureddocument>
        <D:hassubs>0</D:hassubs>
        <D:nosubs>0</D:nosubs>
        <D:objectcount>3</D:objectcount>
        <D:reserved>0</D:reserved>
        <D:visiblecount>3</D:visiblecount>
        <Z:Win32CreationTime>Wed, 01 Feb 2017 20:02:25 GMT</Z:Win32CreationTime>
        <Z:Win32LastAccessTime>Wed, 08 Feb 2017 07:50:46 GMT</Z:Win32LastAccessTime>
        <Z:Win32LastModifiedTime>Wed, 08 Feb 2017 07:50:46 GMT</Z:Win32LastModifiedTime>
        <Z:Win32FileAttributes>00000010</Z:Win32FileAttributes>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
  <D:response>
    <D:href>http://127.0.0.1:11111/%232/README%2520%2520%2520test.md</D:href>
    <D:propstat>
      <D:prop>
        <D:creationdate>2017-02-08T07:50:46.543Z</D:creationdate>
        <D:displayname>README   test.md</D:displayname>
        <D:getcontentlength>2492</D:getcontentlength>
        <D:getcontenttype>application/octet-stream</D:getcontenttype>
        <D:getlastmodified>Wed, 08 Feb 2017 07:50:46 GMT</D:getlastmodified>
        <D:resourcetype />
        <D:lockdiscovery />
        <D:supportedlock>
          <D:lockentry>
            <D:lockscope>
              <D:exclusive />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
          <D:lockentry>
            <D:lockscope>
              <D:shared />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
        </D:supportedlock>
        <D:ishidden>0</D:ishidden>
        <Z:Win32CreationTime>Wed, 08 Feb 2017 07:50:46 GMT</Z:Win32CreationTime>
        <Z:Win32LastAccessTime>Wed, 08 Feb 2017 07:50:46 GMT</Z:Win32LastAccessTime>
        <Z:Win32LastModifiedTime>Wed, 08 Feb 2017 07:50:46 GMT</Z:Win32LastModifiedTime>
        <Z:Win32FileAttributes>00000020</Z:Win32FileAttributes>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
  <D:response>
    <D:href>http://127.0.0.1:11111/%232/README%2520-%2520test.md</D:href>
    <D:propstat>
      <D:prop>
        <D:creationdate>2017-02-08T07:50:33.463Z</D:creationdate>
        <D:displayname>README - test.md</D:displayname>
        <D:getcontentlength>2492</D:getcontentlength>
        <D:getcontenttype>application/octet-stream</D:getcontenttype>
        <D:getlastmodified>Wed, 08 Feb 2017 07:50:33 GMT</D:getlastmodified>
        <D:resourcetype />
        <D:lockdiscovery />
        <D:supportedlock>
          <D:lockentry>
            <D:lockscope>
              <D:exclusive />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
          <D:lockentry>
            <D:lockscope>
              <D:shared />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
        </D:supportedlock>
        <D:ishidden>0</D:ishidden>
        <Z:Win32CreationTime>Wed, 08 Feb 2017 07:50:33 GMT</Z:Win32CreationTime>
        <Z:Win32LastAccessTime>Wed, 08 Feb 2017 07:50:33 GMT</Z:Win32LastAccessTime>
        <Z:Win32LastModifiedTime>Wed, 08 Feb 2017 07:50:33 GMT</Z:Win32LastModifiedTime>
        <Z:Win32FileAttributes>00000020</Z:Win32FileAttributes>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
  <D:response>
    <D:href>http://127.0.0.1:11111/%232/README%2520%25E2%2580%2593%2520test.md</D:href>
    <D:propstat>
      <D:prop>
        <D:creationdate>2017-02-08T07:50:28.558Z</D:creationdate>
        <D:displayname>README - test.md</D:displayname>
        <D:getcontentlength>2492</D:getcontentlength>
        <D:getcontenttype>application/octet-stream</D:getcontenttype>
        <D:getlastmodified>Wed, 08 Feb 2017 07:50:28 GMT</D:getlastmodified>
        <D:resourcetype />
        <D:lockdiscovery />
        <D:supportedlock>
          <D:lockentry>
            <D:lockscope>
              <D:exclusive />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
          <D:lockentry>
            <D:lockscope>
              <D:shared />
            </D:lockscope>
            <D:locktype>
              <D:write />
            </D:locktype>
          </D:lockentry>
        </D:supportedlock>
        <D:ishidden>0</D:ishidden>
        <Z:Win32CreationTime>Wed, 08 Feb 2017 07:50:28 GMT</Z:Win32CreationTime>
        <Z:Win32LastAccessTime>Wed, 08 Feb 2017 07:50:28 GMT</Z:Win32LastAccessTime>
        <Z:Win32LastModifiedTime>Wed, 08 Feb 2017 07:50:28 GMT</Z:Win32LastModifiedTime>
        <Z:Win32FileAttributes>00000020</Z:Win32FileAttributes>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>
[6]: PROPFIND:http://127.0.0.1:11111/#2:127.0.0.1:11111 - Finished processing (117ms, HTTP result: 207)
ramondeklein commented 7 years ago

I think I only need specific handling for hashes and let the XML encoder encode the rest. I have pushed another commit in this area (d02234f) that should fix it. Hashes are kind of special in this area. Sorry for the inconvenience. Hope you will keep reporting issues...

yar229 commented 7 years ago

Now Far does not show folders with spaces and not eng symbols in names. For example, _WebDAV Test, Camera Uploads, пример

TotalCommander and CarotDAV seems ok.

Sorry for the inconvenience. Hope you will keep reporting issues...

No problem :)

yar229 commented 7 years ago

STOP STOP STOP

Seems like my fault

yar229 commented 7 years ago

image

[6]: PROPFIND:http://127.0.0.1:11111/#2/Camera Uploads:127.0.0.1:11111 - Start processing
[6]: <?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:">
  <allprop />
</propfind>
[6]: PROPFIND:http://127.0.0.1:11111/#2/Camera Uploads:127.0.0.1:11111 - Finished processing (0ms, HTTP result: 404)
ramondeklein commented 7 years ago

Commit 697a073 seems to fix this issue, but I am not happy with this fix. It requires changes to the underlying store. That way the store needs to know how to deal with this "broken" URI scheme. That's not good design. It should be resolved at a higher level.

I am considering to rewrite the URI stuff and work with plain strings (or a custom URL class instead). That way we can isolate this awkward URI encoding stuff and don't bother stores with this functionality. Please comment...

yar229 commented 7 years ago

Everything seems ok at this moment, thanks!

I think, custom URI class will solve this problem, cause it's a big difference to work with standart URI (such as .AbsolutePath translates +, (space)+ , +(space) and so on) and as-is webdav uri

yar229 commented 7 years ago

Would you create nuget package 0.1.24?

ramondeklein commented 7 years ago

Yes, it's already uploaded but not indexed yet: https://www.nuget.org/packages/NWebDav.Server.

image

yar229 commented 7 years ago

Far does not see files with %, as usially, TC and CarotDAV ok. 200%.md It seems the % sign needs to be replaced same way as # :(