Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Truncation of individual "Nodes to Consider"

by cavac (Priest)
on Nov 29, 2021 at 15:31 UTC ( #11139225=note: print w/replies, xml ) Need Help??


in reply to Truncation of individual "Nodes to Consider"

Hmm, stuff with HTML is not that easy to truncate cleanly. It's certainly possible, but the server might have to generate the appropriate end tags. That means at least porting or adapting code from some other place (the post preview function might be a good place to start)

On the other hand, the more annoying a post in NTC is, the faster it will get required votes to "Edit" or "Reap". That is also something to keep in mind. That's the trouble with a nice, friendly place like PM. You can't "admin abuse" a troll unless the community gives you the go ahead.

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

Replies are listed 'Best First'.
Re^2: Truncation of individual "Nodes to Consider"
by kcott (Bishop) on Dec 02, 2021 at 07:12 UTC

    G'day cavac,

    I don't have access to PM code, so I can't comment on how easy or difficult this might be. I did suggest reusing code that I thought was already in place; although, that was just a guess.

    I don't know if your comment about "... the more annoying a post in NTC is ..." is truly valid. Those long posts hung around for quite some time: they're gone now (but it is more than a month later).

    Anyway, thanks for giving this some thought and responding.

    — Ken

      > I did suggest reusing code that I thought was already in place;

      Last time I checked posts were rejected not truncated if longer than x kb (x~~64 ?).

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        update
        hmm ... I just tested posting a file with 67.584 bytes, and surprisingly it went thru ...

        old

        perl -E"say 'x' x 2**6 for 1..2**10"

        next try 2**17

        next try 2**18

Re^2: Truncation of individual "Nodes to Consider"
by LanX (Sage) on Dec 02, 2021 at 12:12 UTC
    > Hmm, stuff with HTML is not that easy to truncate cleanly. It's certainly possible, but the server might have to generate the appropriate end tags.

    PM is using a selfmade configurable parser to

    • "validate" the HTML and
    • activate the markup and
    • deactivate potentially malicious elements.

    IMHO it's not 100% correct and has loopholes.

    A truncation mechanism would need to be added on top of this, which is unlikely.

    Anyway folding away huge branches of the DOM might be far better and easier than truncating, but would still require a better parser.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      G'day Rolf,

      ++ (x3) Thanks for the effort you put in to investigate this. It's appreciated.

      Yes, 64kB is roughly the number I seem to remember seeing in documentation somewhere on this site; unfortunately, I can't locate this and don't remember the exact number. Also, I'm pretty certain I've never attempted to post anything that large.

      It looks like implementing this request would involve a massive amount of work and, as such, probably won't happen. That's fine: it's just a feature, not a bug fix, and the situation that I described only occurs rarely.

      — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139225]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-01-26 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (69 votes). Check out past polls.

    Notices?