deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

Remove the last non-standard footer, not the first one

Open link2xt opened this issue 4 years ago • 7 comments

If there are multiple non-standard footers, like

Message
--------------
more info
--------------
footer

DC currently cuts the message after the first -------------- rather than the last.

link2xt avatar Feb 08 '21 08:02 link2xt

hm, i agree with footers, but the current remove_nonstandard_footer() seems to be used to also to detect quotes as follows:

Message
----- Original message -----
foo
--------------
footer

(cmp original comment, this is lost somehow)

so, in this case, just cutting the message after the last ---- might worsening things, maybe showing unneeded garbage. in any case, a "show full message..." with the uncut text will be shown, so, if we cannot detect 100%, i'd tend to vote for cutting.

r10s avatar Feb 08 '21 11:02 r10s

Maybe remove the last footer, and then cut too long messages based on the number of lines and characters? I just tried to subscribe to https://builtformars.com/subscribe/ and the first message I got was cut at the wrong place while at the same time still being huge (partially because of the long links converted to markdown). We can probably stop converting links to markdown now that we have HTML view (which has to be implemented to use the new core anyway).

link2xt avatar Feb 09 '21 00:02 link2xt

cc @Simon-Laux wrt removing URLs from HTML to plaintext conversion, guess you have some opinion on this

link2xt avatar Feb 09 '21 00:02 link2xt

desktop supports labeled links, the other platforms don't support them. So maybe remove them from the plaintext? atleast until we implemented message/markdown parsing for all platforms? I'm not sure what makes those links that long, is the url copied to the label?

Simon-Laux avatar Feb 09 '21 17:02 Simon-Laux

I'm not sure what makes those links that long, is the url copied to the label?

they may come from html conversion - but may also be in the text/plain part of newletters.

remember, we do not support markdown and have no labeled links in text shown in the bubbles therefore (the thing with [label](link) generated by core for html->text conversion - meanwhile i regret that as it led to false assumptions, maybe we should convert html to label (link) here)

Maybe remove the last footer, and then cut too long messages based on the number of lines and characters?

yip, this is also what i have roughly in mind, i will open an explicit issue for that, so we can discuss that more focused. did so: https://github.com/deltachat/deltachat-core-rust/issues/2213

and yes, if we are doing sth. as #2213, i would be fine with cutting at the last non-standard-footer.

r10s avatar Feb 09 '21 20:02 r10s

I'm not sure what makes those links that long, is the url copied to the label?

The problem is UTM parameters. We can also remove them for user privacy if we decide to keep the URLs in plaintext. HTML text will be unchanged anyway as we don't really parse it.

link2xt avatar Feb 10 '21 05:02 link2xt

removing tracking parameters is a thing to think about at some point, yes. thanks for pointing directly in this direction.

but i would not see that as a general solution to fix long urls (k, no one said that :) - removing tracking parameter probably has issues on its own, there may be too long urls for other reasons or for tracking parameters we do not recognize.

r10s avatar Feb 10 '21 13:02 r10s

We have a "Show full message" button now, so, it's OK enough for now

Hocuri avatar Jul 25 '23 11:07 Hocuri