zbjdonald / synology-drive-api

Synology drive api python wrapper.
MIT License
64 stars 16 forks source link

"update file information failed" when trying to list a file shared with user in question. #7

Closed frdmn closed 1 year ago

frdmn commented 2 years ago

I was using the following line of code to access a certain spreadsheet, shared with the user used in the request below. After updating to DSM 7, and updating this python module to latest version, it suddenly stopped working:

with SynologyDrive(os.environ.get('SYNO_USER'), os.environ.get('SYNO_PASS'), os.environ.get('SYNO_HOST'), dsm_version='7') as synd:
    sheet_file = synd.download_file("543138139674295052")

Returns the following error:

Traceback (most recent call last):
  File "./test.py", line 18, in <module>
    sheet_file = synd.download_file("543138139674295052")
  File "/Users/jonas/Library/Python/3.8/lib/python/site-packages/synology_drive_api/files.py", line 151, in download_file
    ret = self.get_file_or_folder_info(file_path)
  File "/Users/jonas/Library/Python/3.8/lib/python/site-packages/synology_drive_api/files.py", line 126, in get_file_or_folder_info
    return self.session.http_post(endpoint, data=urlencoded_data)
  File "/Users/jonas/Library/Python/3.8/lib/python/site-packages/synology_drive_api/base.py", line 220, in http_post
    return self._request('post', endpoint, **kwargs)
  File "/Users/jonas/Library/Python/3.8/lib/python/site-packages/synology_drive_api/base.py", line 210, in _request
    raise_synology_exception(res, bio_exist=bio_flag)
  File "/Users/jonas/Library/Python/3.8/lib/python/site-packages/synology_drive_api/base.py", line 132, in raise_synology_exception
    raise SynologyException(
synology_drive_api.base.SynologyException: {"error":{"code":1003,"errors":{"line":172,"message":"update file information failed"}},"success":false}

Any ideas why this is suddenly happening?

frdmn commented 2 years ago

Manged to fix it like this:

https://github.com/zbjdonald/synology-drive-api/compare/master...frdmn:fix/get_shared_file?expand=1

Didn't open a PR since I'm not sure if that's the best way to go here nor if it's needed at other places as well. At least now I can access the spread sheet this way again...

zbjdonald commented 2 years ago

Thanks for using this api. I just came to a new company without dsm 7. Would you be open to a PR if other requests are compatible?

frdmn commented 2 years ago

Of course! Is there a test case I can run or what would be the best way to make sure the rest of the requests work fine?

zbjdonald commented 2 years ago

haha, there are no test cases, you can test some api manually.

zbjdonald commented 1 year ago

@frdmn Hi, in 1.0.11, I changed get_file_or_folder_info(). Could you test it in your case?