parsav  Diff

Differences From Artifact [1bb0eb41f3]:

To Artifact [5d2607bf9b]:


   517    517   				return quote
   518    518   					var [me]
   519    519   					[check]
   520    520   				in [me] end
   521    521   			end)()]
   522    522   			if privs:sz() > 0 then
   523    523   				lib.dbg('installing credential restrictions')
   524         -				lib.io.fmt('on priv %llu\n',aid)
   525    524   				co.srv:auth_privs_set(aid, privs)
   526    525   			end
   527    526   
   528    527   			lib.dbg('setting netmask restrictions')
   529    528   			var nm = co:pgetv('netmask')
   530    529   		end
   531    530   		co:reroute('?')
................................................................................
   905    904   	end
   906    905   end
   907    906   
   908    907   
   909    908   terra http.local_avatar(co: &lib.srv.convo, handle: lib.mem.ptr(int8))
   910    909   	-- TODO retrieve user avatars
   911    910   	var usr = co.srv:actor_fetch_xid(handle)
   912         -	if not usr then
   913         -	goto default end
   914         -	if usr(0).origin == 0 then
   915         -		if usr(0).avatarid == 0 then goto default end
   916         -		var avi, mime = co.srv:artifact_load(usr(0).avatarid)
   917         -		if not avi then goto default end
   918         -		defer avi:free() defer mime:free()
   919         -		co:bytestream(mime,avi)
   920         -	else
   921         -		co:reroute(usr(0).avatar)
   922         -	end
   923         -	do return end
          911  +	if not usr then goto default end
          912  +	do defer usr:free()
          913  +		if usr(0).origin == 0 then
          914  +			if usr(0).avatarid == 0 then goto default end
          915  +			var avi, mime = co.srv:artifact_load(usr(0).avatarid)
          916  +			if not avi then goto default end
          917  +			defer avi:free() defer mime:free()
          918  +			co:bytestream(mime,avi)
          919  +		else
          920  +			co:reroute(usr(0).avatar)
          921  +		end
          922  +	return end
   924    923   	::default:: co:reroute('/s/default-avatar.webp')
   925    924   end
   926    925   
   927    926   terra http.file_serve_raw(co: &lib.srv.convo, id: lib.mem.ptr(int8))
   928    927   	var id, idok = lib.math.shorthand.parse(id.ptr, id.ct)
   929    928   	if not idok then goto e404 end
   930    929   	var data, mime = co.srv:artifact_load(id)