LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

Some distributions on CPAN bundle and link to html files, like the module Sepia which links to ./pod/Sepia.html , which is dead now

I can manually browse

https://metacpan.org/release/SEANO/Sepia-0.992/source/Sepia.html

but I can only see the HTML source and not the rendered version.

I suppose all this used to "work" on old cpan.org

Is there a trick to get this at least manually fixed?

I seem to remember there was one on github by changing the url.

edit

I'm not sure if this problem is particular to this distribution or also others on MetaCPAN

UPDATE: clarification

This question is about if

It's not unlikely that I'm just missing a feature of metacpan here, that's why I ask.

One could probably argue that

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re: Display bundled html files on MetaCPAN
by haj (Vicar) on Mar 10, 2023 at 12:49 UTC

    In the Olden Days (IE6 or so) some browsers took the liberty to guess the content type, and override the header provided by the server.... we won't get that back.

    MetaCPAN does recognize content types for images, as for example in Prima's form builder, so maybe they could be nudged into mapping .html files to Content-type: text/html.

    In the meantime, since this is about Emacs, you can do

    (shr-render-buffer (url-retrieve-synchronously "https://fastapi.metacpan.org/source/SEANO/Sepia-0.992/Sepia.html"))

    ...and read the content in Emacs. This is a bit dirty because it also renders the HTTP headers, but I'm too lazy to fix that right now. If you activate perl-doc-mode in that buffer, you can also get an imenu table of contents.

      MetaCPAN does recognize content types for images, as for example in Prima's form builder, so maybe they could be nudged into mapping .html files to Content-type: text/html.

      This has XSS implications.

        > This has XSS implications

        I'm sure I was able to trigger a referring of HTML files on GitHub.

        So either

        • they ignore XSS,
        • they have found a way to control it or
        • or they delegate the responsibility to the user who clicked the button

        Cheers Rolf
        (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
        Wikisyntax for the Monastery

Re: Display bundled html files on MetaCPAN
by rizzo (Curate) on Mar 10, 2023 at 01:38 UTC

    Is there a trick to get this at least manually fixed?

    I guess you already considered to download sepia.html and remove/decode the html entities using HTML::Entities or Mojo::Util?

      There's no need to do that as the raw HTML can be seen here:

      https://fastapi.metacpan.org/source/SEANO/Sepia-0.992/Sepia.html

      However, I assume LanX wants to see the rendered HTML, not the code, and without a save-to-disk-and-reopen step.

        There's no need to do that as the raw HTML can be seen here:

        In this case the browser fails to render the page because the server sends a Content-Type: text/plain in the http header instead of Content-Type: text/html as it would be expected.

        Maybe this save-to-disk-and-reopen step is not the most elegant way to solve this, but it is the most simple trick that at least I can imagine. And it helps here too.

        FWIW saving this file to a temp dir with Ctrl S and clicking the download helped.

        Not what I was looking for but thanks :)

        Cheers Rolf
        (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
        Wikisyntax for the Monastery