~vpzom/lotide

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
5 2

Question about lotide/hitide

Details
Message ID
<5432858.DvuYhMxLoT@hoshi>
DKIM signature
missing
Download raw message
Hi Colin,

I want to develop a patch for lotide and hitide to fix the following thing:

If I want to "Add by ID" a community and use "1" as a query, I get a 500 
Internal server error in hitide.
The API returns a lotide::Error::InternalStrStatic, but hitide gets a 
RemoteError((500, "Internal Server Error")).
The error happens because lotide::routes::api::parse_lookup() returns the 
error.

I guess that's because hyper does some conversion in between.
I would like to be able to show the user a page indicating that the query was 
invalid.

How would you approach this? Where do I have to look for howto return a less 
generic error to hitide?

I would love to get some pointers from you for this, so I can develop the 
patch on my own, to get to know the codebase better.

-- 
Matthias
Details
Message ID
<44484a1d-4a27-432f-9c83-909d32b5b355@vpzom.click>
In-Reply-To
<5432858.DvuYhMxLoT@hoshi> (view parent)
DKIM signature
missing
Download raw message
All errors in lotide are eventually represented by the Error struct from
src/main.rs. UserError and RoutingError are the only variants that are
returned to clients, the others are converted to 500. In this case, I
think the best path would be to change route_unstable_actors_lookup to
return a UserError if `parse_lookup` fails. Alternately, maybe it should
just return an empty array in this case since it's basically still a
"not found"

[PATCH] Include cleaned HTML from remote as raw

Details
Message ID
<1796344.tdWV9SEqCh@hoshi>
In-Reply-To
<44484a1d-4a27-432f-9c83-909d32b5b355@vpzom.click> (view parent)
DKIM signature
missing
Download raw message
Patch: +4 -1
Following the discussion on the ML, this implements rendering of the
remote HTML after cleaning it using ammonia.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Suggested-by: Colin Reeder <colin@vpzom.click>
CC: Colin Reeder <colin@vpzom.click>
---
 src/routes/mod.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/routes/mod.rs b/src/routes/mod.rs
index 67d3ad4..18c03cb 100644
--- a/src/routes/mod.rs
+++ b/src/routes/mod.rs
@@ -1338,6 +1338,9 @@ async fn page_user(

    let title = user.as_ref().username.as_ref();

    let clean_user_desc = ammonia::clean(user.description.as_ref());
    let user_description = render::raw! { clean_user_desc.as_str() };

    Ok(html_response(render::html! {
        <HTPage base_data={&base_data} lang={&lang} title>
            <h1>{title}</h1>
@@ -1427,7 +1430,7 @@ async fn page_user(
                    None
                }
            }
            <p>{user.description.as_ref()}</p>
            <p>{ user_description }</p>
            {
                if things.is_empty() {
                    Some(render::rsx! { <p>{lang.tr("nothing", None)}</p> })
-- 
2.29.2

Re: [PATCH] Include cleaned HTML from remote as raw

Details
Message ID
<13c635dc-82dd-83d5-8c41-a974bc0dd042@vpzom.click>
In-Reply-To
<1796344.tdWV9SEqCh@hoshi> (view parent)
DKIM signature
missing
Download raw message
While there are currently cases where hitide sanitizes content, this is
a hold-over from before lotide did sanitization. This should actually be
implemented there instead, and then frontends can trust the API response
as-is

Re: [PATCH] Include cleaned HTML from remote as raw

Details
Message ID
<2780744.e9J7NaK4W3@hoshi>
In-Reply-To
<1796344.tdWV9SEqCh@hoshi> (view parent)
DKIM signature
missing
Download raw message
oh noez, I replied to the wrong thread here.
I'm sorry for the messup. :'-(

Do you want me to re-send the patchset to the proper thread?

Re: [PATCH] Include cleaned HTML from remote as raw

Details
Message ID
<7879941.T7Z3S40VBb@hoshi>
In-Reply-To
<13c635dc-82dd-83d5-8c41-a974bc0dd042@vpzom.click> (view parent)
DKIM signature
missing
Download raw message
ah, okay. I will re-develop the patches for lotide.
But not today, or I will mess up even more! :-)
Reply to thread Export thread (mbox)