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

fix: 修改图片上传像素校验位200亿 #943

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dataset/serializers/image_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from rest_framework import serializers

from common.exception.app_exception import NotFound404
from common.field.common import UploadedFileField
from common.field.common import UploadedImageField
from common.util.field_message import ErrMessage
from dataset.models import Image


class ImageSerializer(serializers.Serializer):
image = UploadedFileField(required=True, error_messages=ErrMessage.file("图片"))
image = UploadedImageField(required=True, error_messages=ErrMessage.image("图片"))

def upload(self, with_valid=True):
if with_valid:
Expand Down
4 changes: 3 additions & 1 deletion apps/smartdoc/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import os
from pathlib import Path

from PIL import Image

from ..const import CONFIG, PROJECT_DIR

mimetypes.add_type("text/css", ".css", True)
mimetypes.add_type("text/javascript", ".js", True)
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Image.MAX_IMAGE_PIXELS = 20000000000
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

Expand Down
Loading