owncloud / owncloud-sdk

:cloud: ownCloud client library for JavaScript
https://owncloud.dev/owncloud-sdk/
MIT License
75 stars 33 forks source link

getFileContents fails on images #45

Open zeidlos opened 6 years ago

zeidlos commented 6 years ago

https://github.com/noveens/js-owncloud-client/blob/4395837f02ee4700675fabbbb06dd9b1292e3c1a/owncloud/fileManagement.js#L78

Observed behavior: oc.files.getFileContents(file.name) returns a string that is much bigger than the image it should return.

A 1.2MB (fs size) image returns as 2.2MB String.

Desired behavior: It should pipe the content 1:1.

Maybe I am not getting something very important here and this issue is just garbage, but please let me know.

Meta: Trying to create a proxy for owncloud hosted images. So xy.z/slideshow returns an object with all the images in a special folder and xy.z/slideshow/1 returns the first image as an image, not as an url. And here it breaks. Sadly it's in a private repository. Syncing the ownCloud is not really a desired option.

noveens commented 6 years ago

Hey @zeidlos ,

Sorry for the late reply, can't seem to find an email from GitHub. I'd try to find and solve the issue you mentioned, but unfortunately, I have been a little busy because of my university.

But yeah, if you have some free time on your hand, PRs are welcome! :wink: