mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-14 14:22:16 +00:00
commit
f180e76be9
2 changed files with 31 additions and 8 deletions
22
.deepsource.toml
Normal file
22
.deepsource.toml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
version = 1
|
||||||
|
|
||||||
|
[[analyzers]]
|
||||||
|
name = "javascript"
|
||||||
|
|
||||||
|
[analyzers.meta]
|
||||||
|
environment = ["browser"]
|
||||||
|
|
||||||
|
[[analyzers]]
|
||||||
|
name = "python"
|
||||||
|
|
||||||
|
[analyzers.meta]
|
||||||
|
runtime_version = "3.x.x"
|
||||||
|
|
||||||
|
[[analyzers]]
|
||||||
|
name = "docker"
|
||||||
|
|
||||||
|
[analyzers.meta]
|
||||||
|
dockerfile_paths = ["/TFR/Dockerfile"]
|
||||||
|
|
||||||
|
[[transformers]]
|
||||||
|
name = "black"
|
|
@ -36,7 +36,7 @@ def settings():
|
||||||
flash("Password is incorrect!", "error")
|
flash("Password is incorrect!", "error")
|
||||||
return redirect(url_for("account.settings"))
|
return redirect(url_for("account.settings"))
|
||||||
|
|
||||||
if "file" in request.files and request.files['file'].filename:
|
if "file" in request.files and request.files["file"].filename:
|
||||||
picture = request.files["file"]
|
picture = request.files["file"]
|
||||||
file_ext = picture.filename.split(".")[-1].lower()
|
file_ext = picture.filename.split(".")[-1].lower()
|
||||||
file_name = f"{user.id}.{file_ext}"
|
file_name = f"{user.id}.{file_ext}"
|
||||||
|
@ -44,17 +44,18 @@ def settings():
|
||||||
if file_ext not in UPLOAD_EXTENSIONS:
|
if file_ext not in UPLOAD_EXTENSIONS:
|
||||||
error.append("Picture is not a valid image!")
|
error.append("Picture is not a valid image!")
|
||||||
if picture.content_length > UPLOAD_MAX_SIZE:
|
if picture.content_length > UPLOAD_MAX_SIZE:
|
||||||
error.append(f"Picture must be less than {UPLOAD_EXTENSIONS / 1000000}MB!")
|
error.append(
|
||||||
|
f"Picture must be less than {UPLOAD_EXTENSIONS / 1000000}MB!"
|
||||||
|
)
|
||||||
|
|
||||||
image = Image.open(picture.stream)
|
image = Image.open(picture.stream)
|
||||||
|
|
||||||
# Resizing gifs is more work than it's worth
|
# Resizing gifs is more work than it's worth
|
||||||
if file_ext != "gif":
|
if file_ext != "gif":
|
||||||
image_x, image_y = image.size
|
image_x, image_y = image.size
|
||||||
image.thumbnail((
|
image.thumbnail(
|
||||||
min(image_x, UPLOAD_RESOLUTION),
|
(min(image_x, UPLOAD_RESOLUTION), min(image_y, UPLOAD_RESOLUTION))
|
||||||
min(image_y, UPLOAD_RESOLUTION)
|
)
|
||||||
))
|
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
for err in error:
|
for err in error:
|
||||||
|
|
Loading…
Add table
Reference in a new issue