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

files.upload_stream not working with NextCloud 30.0.2 and chunk_size >= 5 * 1024 * 1024 #319

Open
Mathieu-Ghaleb opened this issue Nov 20, 2024 · 0 comments

Comments

@Mathieu-Ghaleb
Copy link

Mathieu-Ghaleb commented Nov 20, 2024

Describe the bug

Calling files.upload_stream is not working with NextCloud 30.0.2 unless chunk_size is below 5 * 1024 * 1024

Steps/Code to Reproduce

from io import BytesIO

from PIL import Image  # this example requires `pillow` to be installed

import nc_py_api

if __name__ == "__main__":
    nc = nc_py_api.Nextcloud(nextcloud_url="http://nextcloud.local", nc_auth_user="admin", nc_auth_pass="admin")
    buf = BytesIO()
    Image.merge(
        "RGB",
        [
            Image.linear_gradient(mode="L"),
            Image.linear_gradient(mode="L").transpose(Image.ROTATE_90),
            Image.linear_gradient(mode="L").transpose(Image.ROTATE_180),
        ],
    ).save(
        buf, format="PNG"
    )  # saving image to the buffer
    buf.seek(0)  # setting the pointer to the start of buffer
    nc.files.upload_stream("RGB.png", buf)  # uploading file from the memory to the user's root folder
    exit(0)

### Expected Results

File is uploaded successfully

### Actual Results

NextcloudException: [400] Bad Request <upload_stream(v=True): user=admin, path=RGB.png, cur_size=759>

### Setup configuration

nc_py_api = 0.18.0
nextcloud = 30.0.2
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

No branches or pull requests

1 participant