diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d1d134..bb2ad040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Users don't have access to a task object anymore if they are assigneed only on some jobs of the task () - Different resources (tasks, projects) are not visible anymore for all CVAT instance users by default () +- Replaced 'django_sendfile' with 'django_sendfile2' () ### Deprecated - Job field "status" is not used in UI anymore, but it has not been removed from the database yet () diff --git a/Dockerfile b/Dockerfile index 689a48b7..3b170bdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN curl -sL https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 --outp # Install requirements RUN python3 -m venv /opt/venv ENV PATH="/opt/venv/bin:${PATH}" -RUN python3 -m pip install --no-cache-dir -U pip==21.0.1 setuptools==53.0.0 wheel==0.36.2 +RUN python3 -m pip install --no-cache-dir -U pip==22.0.2 setuptools==60.6.0 wheel==0.37.1 COPY cvat/requirements/ /tmp/requirements/ RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt diff --git a/cvat/apps/engine/backup.py b/cvat/apps/engine/backup.py index 50b47cbb..19deec38 100644 --- a/cvat/apps/engine/backup.py +++ b/cvat/apps/engine/backup.py @@ -21,7 +21,7 @@ from rest_framework import serializers, status from rest_framework.parsers import JSONParser from rest_framework.renderers import JSONRenderer from rest_framework.response import Response -from sendfile import sendfile +from django_sendfile import sendfile import cvat.apps.dataset_manager as dm from cvat.apps.engine import models diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index bb9847c0..5714800f 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -35,7 +35,7 @@ from rest_framework.permissions import SAFE_METHODS from rest_framework.renderers import JSONRenderer from rest_framework.response import Response from rest_framework.exceptions import PermissionDenied -from sendfile import sendfile +from django_sendfile import sendfile import cvat.apps.dataset_manager as dm import cvat.apps.dataset_manager.views # pylint: disable=unused-import diff --git a/cvat/apps/opencv/views.py b/cvat/apps/opencv/views.py index 8e493fea..d0b3b265 100644 --- a/cvat/apps/opencv/views.py +++ b/cvat/apps/opencv/views.py @@ -1,7 +1,7 @@ import os import glob from django.conf import settings -from sendfile import sendfile +from django_sendfile import sendfile def OpenCVLibrary(request): dirname = os.path.join(settings.STATIC_ROOT, 'opencv', 'js') diff --git a/cvat/requirements/base.txt b/cvat/requirements/base.txt index a3adadc8..cd8ca7fe 100644 --- a/cvat/requirements/base.txt +++ b/cvat/requirements/base.txt @@ -18,7 +18,7 @@ requests==2.26.0 rq==1.5.1 rq-scheduler==0.10.0 sqlparse==0.4.2 -django-sendfile==0.3.11 +django-sendfile2==0.6.1 dj-pagination==2.5.0 python-logstash-async==2.2.0 django-revproxy==0.10.0 diff --git a/cvat/settings/base.py b/cvat/settings/base.py index c7593eaa..d8db3e86 100644 --- a/cvat/settings/base.py +++ b/cvat/settings/base.py @@ -106,7 +106,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django_rq', 'compressor', - 'sendfile', + 'django_sendfile', 'dj_pagination', 'revproxy', 'rest_framework', @@ -498,3 +498,8 @@ TUS_DEFAULT_CHUNK_SIZE = 104857600 # 100 mb # More about forwarded headers - https://doc.traefik.io/traefik/getting-started/faq/#what-are-the-forwarded-headers-when-proxying-http-requests # How django uses X-Forwarded-Proto - https://docs.djangoproject.com/en/2.2/ref/settings/#secure-proxy-ssl-header SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') + + +# Django-sendfile requires to set SENDFILE_ROOT +# https://github.com/moggers87/django-sendfile2 +SENDFILE_ROOT = BASE_DIR diff --git a/cvat/settings/development.py b/cvat/settings/development.py index 43edc986..c0a920fe 100644 --- a/cvat/settings/development.py +++ b/cvat/settings/development.py @@ -14,8 +14,8 @@ INSTALLED_APPS += [ ALLOWED_HOSTS.append('testserver') # Django-sendfile: -# https://github.com/johnsensible/django-sendfile -SENDFILE_BACKEND = 'sendfile.backends.development' +# https://github.com/moggers87/django-sendfile2 +SENDFILE_BACKEND = 'django_sendfile.backends.development' # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases diff --git a/cvat/settings/production.py b/cvat/settings/production.py index 5b6b4a92..b12b9f16 100644 --- a/cvat/settings/production.py +++ b/cvat/settings/production.py @@ -16,8 +16,8 @@ for key in RQ_QUEUES: RQ_QUEUES[key]['HOST'] = os.getenv('CVAT_REDIS_HOST', 'cvat_redis') # Django-sendfile: -# https://github.com/johnsensible/django-sendfile -SENDFILE_BACKEND = 'sendfile.backends.xsendfile' +# https://github.com/moggers87/django-sendfile2 +SENDFILE_BACKEND = 'django_sendfile.backends.xsendfile' # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases diff --git a/tests/cypress/support/commands_projects.js b/tests/cypress/support/commands_projects.js index 29273ad8..a7f73b4e 100644 --- a/tests/cypress/support/commands_projects.js +++ b/tests/cypress/support/commands_projects.js @@ -152,8 +152,9 @@ Cypress.Commands.add('restoreProject', (archiveWithBackup) => { Cypress.Commands.add('getDownloadFileName', () => { cy.intercept('GET', '**=download').as('download'); cy.wait('@download').then((download) => { - const filename = download.response.headers['content-disposition'].split('filename="b\'')[1].split('\'')[0]; - return filename; + const filename = download.response.headers['content-disposition'].split(';')[1].split('filename=')[1]; + // need to remove quotes + return filename.substring(1, filename.length - 1); }); });