Skip to content

Links to directories should fail when running offline #1765

@katrinafyi

Description

@katrinafyi

I had a bug where an index.html wasn't being generated. Lychee didn't catch this because the directory still existed, it was just missing the index.html and causing a 404 in the browser.

You can reproduce it like this:

mkdir -p a/empty
echo '[hi](a/empty)' > a.md
lychee a.md

No errors are reported, but I think that this should be an error. It should only succeed if a index.html or similar is present.

The current behaviour could be correct if the web server generates directory listings. However, I don't think that Lychee should implicitly make that assumption - many static hosting services will not generate a directory list. This is related to #542. Failing with an error could prompt the user to look into the issue and add workarounds as needed (like #542).

In general, while I understand that it's not possible to match every web server implementation, I think that the offline checking should be clearer about what assumptions it makes. This would make it more useful and reliable, and the user can evaluate whether those assumptions line up with their environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions