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

Update to Django 3.1.12. #3378

Merged
merged 2 commits into from Jun 30, 2021
Merged

Conversation

MashaSS
Copy link
Contributor

@MashaSS MashaSS commented Jun 30, 2021

Motivation and context

There is one commit in Django 3.1.11 which change the logic of file name validation (django/django@b7d4a6f). Before this commit it checked file name and transformed it by CVAT function to full upload path. After commit at first CVAT function give absolute path then Django check obtained path and failed with error SuspiciousFileOperation because it is the absolute path.

It leads to failures with response code 400 while trying to create a new task.

It is needed to change function upload_path_handler in cvat/cvat/apps/engine/models.py and don’t use absolute paths to avoid this error.

How has this been tested?

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

@MashaSS MashaSS requested a review from nmanovic as a code owner June 30, 2021 06:37
@@ -275,7 +275,7 @@ def get_available_name(self, name, max_length=None):
return name

def upload_path_handler(instance, filename):
return os.path.join(instance.data.get_upload_dirname(), filename)
return os.path.join(os.path.relpath(instance.data.get_upload_dirname(), settings.BASE_DIR), filename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MashaSS , Please add a comment why we have to do the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment to function and a line to CHANGELOG.md.

@nmanovic
Copy link
Contributor

@MashaSS , please add a line into CHANGELOG.md

@nmanovic nmanovic merged commit 0c524c6 into cvat-ai:develop Jun 30, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants