From 60c0993d59efe67535412c2992ce71632a446ef0 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Thu, 18 Sep 2025 19:45:17 +0200 Subject: [PATCH] added steps to correct content type in minio --- .gitea/workflows/sync-annotations.yml | 12 ++++++++++-- data_store/repositories/annotation_repository.py | 3 ++- data_store/repositories/image_repository.py | 3 ++- uv.lock | 12 ++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/sync-annotations.yml b/.gitea/workflows/sync-annotations.yml index b0e0230..0173f60 100644 --- a/.gitea/workflows/sync-annotations.yml +++ b/.gitea/workflows/sync-annotations.yml @@ -13,8 +13,16 @@ jobs: env: LABEL_STUDIO_API_TOKEN: ${{ secrets.LABEL_STUDIO_API_TOKEN }} run: | - # Replace and with your actual values. - # The storage_id can be found in the URL when you view your cloud storage in Label Studio. curl -X POST \ -H "Authorization: Token $LABEL_STUDIO_API_TOKEN" \ "https://label-studio.gt-proj.com/api/storages/export/s3/1/sync" + + - name: Fix MinIO file content type + env: + MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }} + MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }} + run: | + mc alias set myminio http://10.0.0.2:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY + mc mirror --recursive --overwrite --attr 'Content-Type=application/json' \ + myminio/visual-semiotic-ai-analysis/label-studio-output \ + myminio/visual-semiotic-ai-analysis/label-studio-output diff --git a/data_store/repositories/annotation_repository.py b/data_store/repositories/annotation_repository.py index 06c91af..b40baa1 100644 --- a/data_store/repositories/annotation_repository.py +++ b/data_store/repositories/annotation_repository.py @@ -23,6 +23,7 @@ class AnnotationRepository(MinioAdapter, AnnotationRepositoryInterface): encoding: str = "utf-8" data_format: str = "json" + content_type: str = "application/json" folder_name: str = "annotations" @classmethod @@ -81,7 +82,7 @@ class AnnotationRepository(MinioAdapter, AnnotationRepositoryInterface): buffer = BytesIO(data_bytes) # Put object object_name = self._object_name(job_id) - self._put(object_name, buffer) + self._put(object_name, buffer, self.content_type) def delete(self, job_id: UUID) -> None: """Delete an Annotation by its job ID.""" diff --git a/data_store/repositories/image_repository.py b/data_store/repositories/image_repository.py index 9c07a3f..d102d5c 100644 --- a/data_store/repositories/image_repository.py +++ b/data_store/repositories/image_repository.py @@ -15,6 +15,7 @@ class ImageRepository(MinioAdapter, ImageRepositoryInterface): """ImageRepository implementation using MinIO as the backend.""" image_format: str = "PNG" + content_type: str = "image/png" folder_name: str = "images" @classmethod @@ -57,7 +58,7 @@ class ImageRepository(MinioAdapter, ImageRepositoryInterface): image.save(buffer, self.image_format) # Put object object_name = self._object_name(image_id) - self._put(object_name, buffer) + self._put(object_name, buffer, self.content_type) def delete(self, image_id: UUID) -> None: """Delete an Image by its ID.""" diff --git a/uv.lock b/uv.lock index f3e1d11..3dfdb70 100644 --- a/uv.lock +++ b/uv.lock @@ -60,14 +60,14 @@ wheels = [ [[package]] name = "authlib" -version = "1.6.3" +version = "1.6.4" source = { registry = "http://10.0.0.2:5001/index/" } dependencies = [ { name = "cryptography" }, ] -sdist = { url = "http://10.0.0.2:5001/index/authlib/authlib-1.6.3.tar.gz", hash = "sha256:9f7a982cc395de719e4c2215c5707e7ea690ecf84f1ab126f28c053f4219e610" } +sdist = { url = "http://10.0.0.2:5001/index/authlib/authlib-1.6.4.tar.gz", hash = "sha256:104b0442a43061dc8bc23b133d1d06a2b0a9c2e3e33f34c4338929e816287649" } wheels = [ - { url = "http://10.0.0.2:5001/index/authlib/authlib-1.6.3-py2.py3-none-any.whl", hash = "sha256:7ea0f082edd95a03b7b72edac65ec7f8f68d703017d7e37573aee4fc603f2a48" }, + { url = "http://10.0.0.2:5001/index/authlib/authlib-1.6.4-py2.py3-none-any.whl", hash = "sha256:39313d2a2caac3ecf6d8f95fbebdfd30ae6ea6ae6a6db794d976405fdd9aa796" }, ] [[package]] @@ -946,15 +946,15 @@ wheels = [ [[package]] name = "python-repositories" -version = "0.2.2" +version = "0.2.3" source = { registry = "https://gitea.gt-proj.com/api/packages/brian/pypi/simple/" } dependencies = [ { name = "python-utils" }, { name = "structlog" }, ] -sdist = { url = "https://gitea.gt-proj.com/api/packages/brian/pypi/files/python-repositories/0.2.2/python_repositories-0.2.2.tar.gz", hash = "sha256:81d690ca632366f24c2cdf7d550d087810ebc6d305be5bc3e0fad6dacfd9acfe" } +sdist = { url = "https://gitea.gt-proj.com/api/packages/brian/pypi/files/python-repositories/0.2.3/python_repositories-0.2.3.tar.gz", hash = "sha256:216d1f7cd14ff690c5e6af502a05c7a5de8bfb3202eabf25aa9dbce83b0f384d" } wheels = [ - { url = "https://gitea.gt-proj.com/api/packages/brian/pypi/files/python-repositories/0.2.2/python_repositories-0.2.2-py3-none-any.whl", hash = "sha256:3d521b31a9ba21e2113f8ab4b24449ba6767a60c9c22cf75c29a9eb198fc250a" }, + { url = "https://gitea.gt-proj.com/api/packages/brian/pypi/files/python-repositories/0.2.3/python_repositories-0.2.3-py3-none-any.whl", hash = "sha256:aa2ef4702f341b89cd973e6e7cfc8a288a5340c67d09ae281285f0a30edec96e" }, ] [package.optional-dependencies]