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

Sharing a directory #218

Open
steve500002 opened this issue Jul 11, 2018 · 16 comments
Open

Sharing a directory #218

steve500002 opened this issue Jul 11, 2018 · 16 comments

Comments

@steve500002
Copy link

When attempting to share a directory:
share_link = oc.share_file_with_link(directory)

I get
'id': data_el.find('id').text,
AttributeError: 'NoneType' object has no attribute 'text'

I know that the function explicitly talks about files, but documentation says I can share directories and there is not a share_directory_with_link function so I am working on basis that this function should work.

Error refers to line 833 - data=post_data

and post data is created on 818
post_data = {
'shareType': self.OCS_SHARE_TYPE_LINK,
'path': self._encode_string(path),
}

Any ideas?

@kevdevg
Copy link

kevdevg commented Jul 18, 2018

same problem, any progress on this?

@PVince81
Copy link
Contributor

it should work with directories as well and I believe some of the unit tests also do so.

please specify what OC version you are using and also check owncloud.log for server side errors

@PVince81
Copy link
Contributor

someone reported the same error when sharing files: #214

so this is not related to sharing folders but sharing in general, please verify the server env for errors

@bbs-web
Copy link

bbs-web commented Oct 2, 2019

First of all: I am using nextcloud 16.05 on a ubuntu/snap installation.

After I done . a little digging into the problem I found out that
the AttributeError: 'NoneType' object has no attribute 'text' pops up because the response doesn't have the expected format. In fact the response returns a list of shares.

<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message>OK</message>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data>
  <element>
   <id>70</id>
   <share_type>1</share_type>
   <uid_owner>admin</uid_owner>
   <displayname_owner>admin</displayname_owner>
   <permissions>31</permissions>
   <stime>1569585670</stime>
   <parent/>
   <expiration/>
   <token/>
   <uid_file_owner>admin</uid_file_owner>
   <note></note>
   <label/>
   <displayname_file_owner>admin</displayname_file_owner>
   <path>/3D Projects/04 Rigging</path>
   <item_type>folder</item_type>
   <mimetype>httpd/unix-directory</mimetype>
   <storage_id>home::admin</storage_id>
   <storage>2</storage>
   <item_source>761</item_source>
   <file_source>761</file_source>
   <file_parent>821</file_parent>
   <file_target>/04 Rigging</file_target>
   <share_with>Rigging</share_with>
   <share_with_displayname>Rigging</share_with_displayname>
   <mail_send>0</mail_send>
   <hide_download>0</hide_download>
  </element>
 ...etc

I checked the Nextcloud API and the request format seemed to be ok. I can't get to the bottom of this, but hopefully the information above might help someone else get to it.

@feelwhy
Copy link

feelwhy commented May 5, 2020

Have faced the same issue. For my particular purposes (need only the URL of share), it is enough to slightly adapt the method share_file_with_link. In particular, replace the part:
'name': data_el.find('name').text
Name does not exist in data. At least in how NextCloud returns that

@PVince81
Copy link
Contributor

PVince81 commented May 6, 2020

Ah, it is possible that Nextcloud did not implement giving names to public links.

A fix would be to add an if condition there to check if that attribute is set or not, and ignore if it's not.

@PVince81
Copy link
Contributor

PVince81 commented May 6, 2020

it seems the original report was about the id field, which I believe should exist in both OC and NC.

the proposed fix could be applied to both fields, just in case

@sergey-sc
Copy link

hi
still no solution?

@kobuki
Copy link

kobuki commented Oct 6, 2020

Seeing the exact same error with pyocclient 0.6, Nextcloud 19.0.1.

@sergey-sc
Copy link

I have solved this issue within installing version 0.4 of pyocclient pip3 install pyocclient==0.4
Works without any errors

@kobuki
Copy link

kobuki commented Oct 6, 2020

@sergey-sc: Thanks, your workaround is working.

drxzcl pushed a commit to drxzcl/pyocclient that referenced this issue Nov 3, 2020
@drxzcl
Copy link

drxzcl commented Nov 3, 2020

I ran into other problems while downgrading, so I implemented a basic fix instead.

@luffah
Copy link

luffah commented Apr 15, 2021

Similar bugs #218, #259. #263 (with a simple fix proposal - a mere workaround)

@victorterancas
Copy link

Hi. I face the same problem as the topic. I see there is a commit, but the library i install (the last one) does not have that changes in it. Could you redo the commit?

@whateverforever
Copy link

having same issue with pyocclient==0.6 and nextcloud==28.0.8

@dbartenstein
Copy link

having same issue with pyocclient==0.6 and nextcloud==28.0.8

Same here.

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

No branches or pull requests