mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修改图片上传像素校验位200亿
This commit is contained in:
parent
8b0b2b4415
commit
452213e6e1
|
|
@ -13,13 +13,13 @@ from django.http import HttpResponse
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@ import mimetypes
|
|||
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/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue