Giter Club home page Giter Club logo

Comments (5)

skazantsev avatar skazantsev commented on May 23, 2024

It's not clear if this is library problem or the WebDAV server misconfiguration.
What HTTP request are you sending? What HTTP response are you getting?

A good starting point is too use a tool like Fiddler to capture HTTP/HTTPS traffic between the application and the WebDAV server and see what kind of response the WebDAV server returns.

If the field is not present in the HTTP response of WebDAV server then it's the expected behavior of the library; otherwise you can send me the WebDAV response and I can investigate if it's a bug in the lib.

To proxy WebDAV calls through Fiddler you need to pass a WebProxy instance to WebDavClient like explained here.

from webdavclient.

skazantsev avatar skazantsev commented on May 23, 2024

Also a displayname property is optional and some WebDAV servers simply don't return it by default.
However, you can include it in a request as an additional property:

var propfindParams = new PropfindParameters
{
  CustomProperties = new[] { XName.Get("displayname", "DAV:") }
};

or

var propfindParams = new PropfindParameters
{
  CustomProperties = new[] { XName.Get("displayname", "DAV:") },
  RequestType = PropfindRequestType.NamedProperties
};

from webdavclient.

Bananas-Are-Yellow avatar Bananas-Are-Yellow commented on May 23, 2024

I'm having the same problem and your suggestion of using PropfindParameters to request displayname explicitly does not seem to help. The WebDAV server is a Synology NAS. I'm on Linux and if I add the WebDAV server to the Nautilus file explorer under Other Locations, all the directory and file names display correctly, so they must be available somehow.

Here is what is returned for one file:

Name: 
IsCollection: False
ContentType: 
ContentLength: 2933

I dumped the WebDavResource.Properties and these are the names -> values found:

{DAV:}resourcetype -> 
{DAV:}creationdate -> 2023-01-26T10:16:38Z
{DAV:}getcontentlength -> 2933
{DAV:}getlastmodified -> Fri, 27 Jan 2023 09:47:06 GMT
{DAV:}getetag -> "b75-5f33bbf8f1a80"
{http://apache.org/dav/props/}executable -> T
{DAV:}supportedlock -> <lp1:lockentry xmlns:lp1="DAV:"><lp1:lockscope><lp1:exclusive /></lp1:lockscope><lp1:locktype><lp1:write /></lp1:locktype></lp1:lockentry><lp1:lockentry xmlns:lp1="DAV:"><lp1:lockscope><lp1:shared /></lp1:lockscope><lp1:locktype><lp1:write /></lp1:locktype></lp1:lockentry>
{DAV:}lockdiscovery -> 

There is no mention of displayname. Any idea what I'm doing wrong?

from webdavclient.

Bananas-Are-Yellow avatar Bananas-Are-Yellow commented on May 23, 2024

I can use curl to make the WebDAV call:

curl -i -X PROPFIND -H "Depth: 1" 'https://<location>' -u <user>

The result contains responses like this:

<D:response xmlns:lp1="DAV:"
    xmlns:lp2="http://apache.org/dav/props/">
    <D:href>/home/Drive/Bangle/putrid-position.md</D:href>
    <D:propstat>
        <D:prop>
            <lp1:resourcetype/>
            <lp1:creationdate>2022-12-20T10:45:31Z</lp1:creationdate>
            <lp1:getcontentlength>31</lp1:getcontentlength>
            <lp1:getlastmodified>Tue, 20 Dec 2022 10:45:29 GMT</lp1:getlastmodified>
            <lp1:getetag>"1f-5f04022626440"</lp1:getetag>
            <lp2:executable>T</lp2:executable>
            <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:lockdiscovery/>
        </D:prop>
        <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
</D:response>

The last piece of the <D:href> path is the displayname information I need.

from webdavclient.

Bananas-Are-Yellow avatar Bananas-Are-Yellow commented on May 23, 2024

I just discovered that you expose the href path as the Uri property. This means I have everything I need.

from webdavclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.