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

cvat-sdk: Fix creating tasks with non-local files #5058

Merged
merged 2 commits into from
Oct 7, 2022

Commits on Oct 7, 2022

  1. Move the test file share contents to tests/share

    This way, it can be reused between tests.
    SpecLad committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    b299a8e View commit details
    Browse the repository at this point in the history
  2. cvat-sdk: Fix creating tasks with non-local files

    Forcing the `Content-Type` for the `upload_data` API call to
    `multipart/form-data` does not work, because the current logic for
    converting Python values to parts (`ApiClient._convert_body_to_post_params`)
    does not encode them in a way that Django REST Framework can understand (it
    JSON-encodes each part).
    
    Fortunately, we don't actually need to do that, since when we create a task
    with non-local files, we don't need to upload any files, and so we can just
    post the original JSON, so do just that.
    
    I couldn't add a test for the remote image case, because CVAT rejects all URLs
    with non-public IP addressses. However, I did test this case manually.
    SpecLad committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    3a04724 View commit details
    Browse the repository at this point in the history