Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add name to propfind response #3158

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Conversation

kobergj
Copy link
Contributor

@kobergj kobergj commented Aug 17, 2022

Adds a field "oc:name" to the propfind response. Example:

curl --insecure -X PROPFIND -u katherine:gemini https://localhost:9200/remote.php/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157\$534bb038-6f9d-4093-946f-133be61fa4e7\!1887651e-4f0b-4d7b-8057-50a6f3945522

<?xml version="1.0"?>                                                                                                                                                                                                                                                                     
<d:multistatus xmlns:s="http://sabredav.org/ns" xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">                                                                                                                                                                                         
  <d:response>                                                                                                                                                                                                                                                                            
    <d:href>/remote.php/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$534bb038-6f9d-4093-946f-133be61fa4e7%211887651e-4f0b-4d7b-8057-50a6f3945522/</d:href>                                                                                                                             
    <d:propstat>                                                                                                                                                                                                                                                                          
      <d:prop>                                                                                                                                                                                                                                                                            
        <oc:id>1284d238-aa92-42ce-bdc4-0b0000009157$534bb038-6f9d-4093-946f-133be61fa4e7!1887651e-4f0b-4d7b-8057-50a6f3945522</oc:id>                                                                                                                                                     
        <oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$534bb038-6f9d-4093-946f-133be61fa4e7!1887651e-4f0b-4d7b-8057-50a6f3945522</oc:fileid>                                                                                                                                             
        <oc:spaceid>534bb038-6f9d-4093-946f-133be61fa4e7</oc:spaceid>                                                                                                                                                                                                                     
        <oc:name>Foldername</oc:name>                                                                                                                                                                                                                                                        
        <d:getetag>"8fd786a26a0291255c2f6f25c2867f5e"</d:getetag>                                                                                                                                                                                                                         
        <oc:permissions>RDNVCK</oc:permissions>                                                                                                                                                                                                                                           
        <d:resourcetype>                                                                                                                                                                                                                                                                  
          <d:collection/>                                                                                                                                                                                                                                                                 
        </d:resourcetype>                                                                                                                                                                                                                                                                 
        <oc:size>8</oc:size>                                                                                                                                                                                                                                                              
        <d:getlastmodified>Wed, 17 Aug 2022 13:03:39 GMT</d:getlastmodified>                                                                                                                                                                                                              
        <oc:favorite>0</oc:favorite>                                                                                                                                                                                                                                                      
      </d:prop>                                                                                                                                                                                                                                                                           
      <d:status>HTTP/1.1 200 OK</d:status>                                                                                                                                                                                                                                                
    </d:propstat>                                                                                                                                                                                                                                                                         
  </d:response>              
</d:multistatus>

Signed-off-by: jkoberg <jkoberg@owncloud.com>
@@ -987,6 +987,10 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
)
}

if md.Name != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a fallback to file.Base(md.Path)? I don't think every storage driver returns name, yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tracking as a dedicated issue in #3161

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in Names like "1284d238-aa92-42ce-bdc4-0b0000009157$534bb038-6f9d-4093-946f-133be61fa4e7!1887651e-4f0b-4d7b-8057-50a6f3945522" on a PROPFIND for a single resource. That was the reason we needed this field anyways.

Imho if the driver doesn't support names the prop is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants