interledger / rfcs

Specifications for Interledger and related protocols

Home Page:https://interledger.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dead links on the website

davidgilbertson opened this issue · comments

Some links work when clicked on GitHub, but not on the website.

For example, in the file https://github.com/interledger/rfcs/blob/master/0027-interledger-protocol-4/0027-interledger-protocol-4.md there is a link to "Interledger Architecture overview" with the URL "../0001-interledger-architecture/0001-interledger-architecture.md#interledger-protocol-suite".

On that page on the website, this gives a 404 because it points directly to an md file.

It seems that when a link is ../some-page/some-page.md then the some-page.md is removed and the link works on the website, BUT, if it's ../some-page/some-page.md#some-anchor - then the .md section isn't removed and results in a 404.

These should be caught by the following lines in the publish script:
https://github.com/interledger/rfcs/blob/master/scripts/generate_web.js#L33-L39

Looks like it's not matching all cases (for example, when there is a URL fragment).

Right, it's that $ that's the problem (since it only matches when the string ends in .md).

This:

replace(/^(\.{2}\/\d{4}-.*)\/(\d{4}-.*\.md)/g, '$1')

would do this::

const tests = [
    {
        input : '../1234-page-name',
        output: '../1234-page-name',
    },
    {
        input : '../1234-page-name#anchor-name',
        output: '../1234-page-name#anchor-name',
    },
    {
        input : '../1234-page-name/1234-page-name.md',
        output: '../1234-page-name',
    },
    {
        input : '../1234-page-name/1234-page-name.md#anchor-name',
        output: '../1234-page-name#anchor-name',
    },
];

But I'm not sure if there was some other case being allowed for.

Let me know if you'd like a PR.

Fixed in #458
If you wanna review that I'll merge it