Skip to content

Commit

Permalink
fix: 修改图片上传像素校验位200亿 (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 authored Aug 7, 2024
1 parent 59af953 commit 9d3e0d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 9d3e0d4

Please sign in to comment.