From 96879894afcbfb691002f6b366693e6fef25e088 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 12 Oct 2022 02:00:18 -0700 Subject: [PATCH] remove 417 (use 409) and reword 418 msg --- files/helpers/const.py | 6 ++---- files/helpers/media.py | 2 +- files/routes/errors.py | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 272555652..d002df3e5 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -284,8 +284,7 @@ ERROR_TITLES = { 409: "Conflict", 413: "Payload Too Large", 415: "Unsupported Media Type", - 417: "Image already exists!", - 418: "WEBM videos are not allowed", + 418: "I'm a teapot", 429: "Too Many Requests", 500: "Internal Server Error", } @@ -300,8 +299,7 @@ ERROR_MSGS = { 409: "There's a conflict between what you're trying to do and what you or someone else has done and because of that you can't do what you're trying to do. So maybe like... don't try and do that? Sorry not sorry", 413: "That's a heckin' chonker of a file! Please make it smaller or maybe like upload it somewhere else idk", 415: "Please upload only Image, Video, or Audio files!", - 417: "Image already exists!", - 418: "Please convert your video to MP4 and re-upload it!", + 418: "this really shouldn't happen now that we autoconvert webm files but if it does there's a cool teapot marsey so there's that", 429: "go spam somewhere else nerd", 500: "Hiiiii it's carp! I think this error means that there's a timeout error. And I think that means something took too long to load so it decided not to work at all. If you keep seeing this on the same page but not other pages, then something is probably wrong with that specific function. It may not be called a function, but that sounds right to me. Anyway, ping me and I'll whine to someone smarter to fix it. Don't bother them. Thanks ily <3", } diff --git a/files/helpers/media.py b/files/helpers/media.py index 28dc91128..133e75c27 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -182,7 +182,7 @@ def process_image(filename=None, resize=0, trim=False, uploader=None, patron=Fal i_hash = str(imagehash.phash(i)) if i_hash in hashes.keys(): os.remove(filename) - abort(417) + abort(409, "Image already exists!") db = db or g.db diff --git a/files/routes/errors.py b/files/routes/errors.py index e8f7776b8..db6c80c1d 100644 --- a/files/routes/errors.py +++ b/files/routes/errors.py @@ -17,9 +17,7 @@ from files.__main__ import app, limiter @app.errorhandler(406) @app.errorhandler(409) @app.errorhandler(413) -@app.errorhandler(414) @app.errorhandler(415) -@app.errorhandler(417) @app.errorhandler(418) @app.errorhandler(429) def error(e):