fix avatars
This commit is contained in:
		@@ -179,7 +179,7 @@ app:post("user_set_avatar", "/:username/set_avatar", function(self)
 | 
				
			|||||||
  local time = os.time()
 | 
					  local time = os.time()
 | 
				
			||||||
  local filename = "u" .. target_user.id .. "d" .. time .. ".webp"
 | 
					  local filename = "u" .. target_user.id .. "d" .. time .. ".webp"
 | 
				
			||||||
  local proxied_filename = "/avatars/" .. filename
 | 
					  local proxied_filename = "/avatars/" .. filename
 | 
				
			||||||
  local save_path = "static" .. proxied_filename
 | 
					  local save_path = "data/static" .. proxied_filename
 | 
				
			||||||
  local res = util.validate_and_create_image(file.content, save_path)
 | 
					  local res = util.validate_and_create_image(file.content, save_path)
 | 
				
			||||||
  if not res then
 | 
					  if not res then
 | 
				
			||||||
    util.inject_warn_infobox(self, "Something went wrong. Try again later.")
 | 
					    util.inject_warn_infobox(self, "Something went wrong. Try again later.")
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								util.lua
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								util.lua
									
									
									
									
									
								
							@@ -203,7 +203,7 @@ function util.destroy_avatar(avatar_id)
 | 
				
			|||||||
    return
 | 
					    return
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  local file_path = "static" .. avatar.file_path
 | 
					  local file_path = "data/static" .. avatar.file_path
 | 
				
			||||||
  local f = io.open(file_path, "r")
 | 
					  local f = io.open(file_path, "r")
 | 
				
			||||||
  if not f then
 | 
					  if not f then
 | 
				
			||||||
    print("can't open avatar file")
 | 
					    print("can't open avatar file")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user