From 68ea17c99c2356fe0f28f39a4583db0a04a47d62 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 22 Aug 2023 13:31:10 +0300 Subject: [PATCH] Updated response code for cloud storage preview not found 204 -> 404 (#6727) ### Motivation and context Resolved #6675 ### How has this been tested? ### Checklist - [x] I submit my changes into the `develop` branch - [x] I have added a description of my changes into the [CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md) file - [ ] I have updated the documentation accordingly - [ ] I have added tests to cover my changes - [ ] I have linked related issues (see [GitHub docs]( https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)) - [ ] I have increased versions of npm packages if it is necessary ([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning), [cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning), [cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning) and [cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning)) ### License - [x] I submit _my code changes_ under the same [MIT License]( https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. --- CHANGELOG.md | 1 + cvat/apps/engine/views.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 664fcc0dfe3..ef46d6622d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Response code for empty cloud storage preview 204 -> 404 () - Organization now opened immediately after it is created () ### Deprecated diff --git a/cvat/apps/engine/views.py b/cvat/apps/engine/views.py index 220502aaa50..23f453e3356 100644 --- a/cvat/apps/engine/views.py +++ b/cvat/apps/engine/views.py @@ -27,7 +27,6 @@ from django.db.models.query import Prefetch from django.http import HttpResponse, HttpResponseNotFound, HttpResponseBadRequest from django.utils import timezone -from http import HTTPStatus from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import ( @@ -2587,7 +2586,7 @@ def preview(self, request, pk): if not db_storage.has_at_least_one_manifest: result = cache.get_cloud_preview_with_mime(db_storage) if not result: - return HttpResponse(status=HTTPStatus.NO_CONTENT) + return HttpResponseNotFound('Cloud storage preview not found') return HttpResponse(result[0], result[1]) preview, mime = cache.get_or_set_cloud_preview_with_mime(db_storage)