mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Allow WebP screenshots (#503)
This commit is contained in:
parent
c6a59701be
commit
0e5158704e
@ -31,7 +31,7 @@ def do_create_screenshot(user: User, package: Package, title: str, file, is_cove
|
||||
if count >= 20:
|
||||
raise LogicError(429, lazy_gettext("Too many requests, please wait before trying again"))
|
||||
|
||||
uploaded_url, uploaded_path = upload_file(file, "image", lazy_gettext("a PNG or JPG image file"))
|
||||
uploaded_url, uploaded_path = upload_file(file, "image", lazy_gettext("a PNG, JPEG, or WebP image file"))
|
||||
|
||||
counter = 1
|
||||
for screenshot in package.screenshots.all():
|
||||
|
@ -28,7 +28,7 @@ def get_extension(filename):
|
||||
return filename.rsplit(".", 1)[1].lower() if "." in filename else None
|
||||
|
||||
|
||||
ALLOWED_IMAGES = {"jpeg", "png"}
|
||||
ALLOWED_IMAGES = {"jpeg", "png", "webp"}
|
||||
|
||||
|
||||
def is_allowed_image(data):
|
||||
@ -43,7 +43,7 @@ def upload_file(file, file_type, file_type_desc):
|
||||
|
||||
is_image = False
|
||||
if file_type == "image":
|
||||
allowed_extensions = ["jpg", "jpeg", "png"]
|
||||
allowed_extensions = ["jpg", "jpeg", "png", "webp"]
|
||||
is_image = True
|
||||
elif file_type == "zip":
|
||||
allowed_extensions = ["zip"]
|
||||
|
@ -16,7 +16,7 @@
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{{ render_field(form.title) }}
|
||||
{{ render_field(form.file_upload, fieldclass="form-control-file", accept="image/png,image/jpeg") }}
|
||||
{{ render_field(form.file_upload, fieldclass="form-control-file", accept="image/png,image/jpeg,image/webp") }}
|
||||
{{ render_submit_field(form.submit) }}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@ -12,7 +12,7 @@
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{{ render_field(form.title) }}
|
||||
{{ render_field(form.file_upload, fieldclass="form-control-file", accept="image/png,image/jpeg") }}
|
||||
{{ render_field(form.file_upload, fieldclass="form-control-file", accept="image/png,image/jpeg,image/webp") }}
|
||||
{{ render_checkbox_field
|
||||
{{ render_submit_field(form.submit) }}
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user