weird icon indicating copy to clipboard operation
weird copied to clipboard

UX Enhancement: Add Graceful Error Handling for Avatar Upload

Open emnul opened this issue 1 year ago • 7 comments

Uploading an avatar image fails with a 500 error

https://github.com/user-attachments/assets/40fdada2-81c5-45ed-a902-26b1c9b5207f

emnul avatar Jul 17 '24 20:07 emnul

Did you ever get the upload to work? It's working for me right now.

You might get more info about the error in the "Response" tab.

zicklag avatar Jul 18 '24 02:07 zicklag

I tried again and it's still not working unfortunately. The "Response" tab only shows the HTML content of the 500 page. I think this is an autogenerated Svelte thing.

<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="../favicon.png" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		
	</head>
	<body data-sveltekit-preload-data="hover" data-theme="wintry">
		<div style="display: contents"><!--[--><!--[--><!--[--><!--[--><!--[--><!--[--><h1>500</h1> <p>Internal Error</p><!--]--><!--]!--><!--]--><!--]--><!--]--> <!--[--><!--]!--><!--]-->
			
			<script>
				{
					__sveltekit_ncevv8 = {
						base: new URL("..", location).pathname.slice(0, -1),
						env: {"PUBLIC_DOMAIN":"weird.one","PUBLIC_TRAEFIK_CONFIG_HOST":"traefik.weird.one.internal:3000","PUBLIC_GH_CLIENT_ID":"687341953dddc37da08e","PUBLIC_MEMBERS_TITLE":"Weird Ones","PUBLIC_GH_REDIRECT_URI":"https://weird.one/account/github/","PUBLIC_DICEBEAR_URL":"https://avatars.weird.one","PUBLIC_DICEBEAR_STYLE":"croodles","PUBLIC_INSTANCE_NAME":"Weird.One","PUBLIC_URL":"https://weird.one"}
					};

					const element = document.currentScript.parentElement;

					const data = [null,null];

					Promise.all([
						import("../_app/immutable/entry/start.Bk1C-ru_.js"),
						import("../_app/immutable/entry/app.DWUUuCkP.js")
					]).then(([kit, app]) => {
						kit.start(app, element, {
							node_ids: [0, 1],
							data,
							form: null,
							error: {message:"Internal Error"},
							status: 500
						});
					});
				}
			</script>
		</div>
	</body>
</html>

emnul avatar Jul 18 '24 16:07 emnul

Strange. Definitely something to fix. What format and size is the file you are trying to upload?

zicklag avatar Jul 18 '24 16:07 zicklag

Didn't work with the following format / sizes: JPEG 1.2MB PNG 1.9 MB

Did actually work with: WEBP 202KB

Looking at the request headers I did notice this

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7

Which leads me to believe maybe the backend doesn't support .png or .jpg image formats for POST requests to the /account/update path

emnul avatar Jul 18 '24 17:07 emnul

I just successfully set this image as my avatar, maybe see if that will work for you:

weirdLogo

zicklag avatar Jul 18 '24 17:07 zicklag

I was able to set my avatar if I converted my image to a WEBP file

emnul avatar Jul 18 '24 21:07 emnul

I made some updates to the public page regarding avatar uploads (#118), could you please check if this error happens after the PR changes when you are free? Thanks a lot!

kimlimjustin avatar Jul 21 '24 17:07 kimlimjustin