mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-16 20:50:25 +00:00
* feat: skip fragment checking for unsupported MIME types The remote URL/website checker currently passes all URLs with fragments to the fragment checker as HTML document, even if it is a different or unsupported MIME type. This can cause false fragment checking for Markdown documents, failures for other MIME types, especially binaries, and unnecessary traffic for large downloads, which are always finished completely, if the fragment checker is invoked. This commit checks the Content-Type header of the response: - Only if it is `text/html`, it is passed to the fragment checker as HTML type. - Only if it is `text/markdown`, of `text/plain` and URL path ends on `.md`, it is passed to the fragment checker as Markdown type. - In all other cases, the fragment checker is skipped and the HTTP status is returned. To invoke the fragment checker with a variable document type, a new `FileType` argument is added to the `check_html_fragment()` function. The fragment checker test and fixture are adjusted to match the expected result: checking a binary file via remote URL with fragment is now expected to succeed, since its Content-Type header does not invoke the fragment checker anymore. Signed-off-by: MichaIng <micha@dietpi.com> * Update fixtures/fragments/file1.md Co-authored-by: MichaIng <micha@dietpi.com> --------- Signed-off-by: MichaIng <micha@dietpi.com> Co-authored-by: Matthias Endler <matthias@endler.dev> |
||
|---|---|---|
| .. | ||
| bench | ||
| cache | ||
| cache_accept_custom_status_codes | ||
| configs | ||
| dump_inputs | ||
| exclude-path | ||
| fallback-extensions | ||
| fragments | ||
| fragments-fallback-extensions | ||
| hidden/.hidden | ||
| ignore | ||
| lycheeignore | ||
| offline | ||
| resolve_paths | ||
| resolve_paths_from_root_dir/nested | ||
| INTERNET_ARCHIVE.md | ||
| LINK_PERIOD.html | ||
| TEST.html | ||
| TEST.md | ||
| TEST_ALL_PRIVATE.md | ||
| TEST_CODE_BLOCKS.md | ||
| TEST_DATA_URIS.html | ||
| TEST_DETAILED_JSON_OUTPUT_ERROR.md | ||
| TEST_DUMP_EXCLUDE.txt | ||
| TEST_EMAIL.md | ||
| TEST_EMAIL_QUERY_PARAMS.html | ||
| TEST_EMAIL_QUERY_PARAMS.md | ||
| TEST_EXAMPLE_DOMAINS.md | ||
| TEST_EXAMPLE_DOMAINS_FALSE_POSITIVES.md | ||
| TEST_GITHUB.md | ||
| TEST_GITHUB_404.md | ||
| TEST_HTML5.html | ||
| TEST_HTML5_CUSTOM_ELEMENTS.html | ||
| TEST_HTML5_LOWERCASE_DOCTYPE.html | ||
| TEST_HTML5_MALFORMED_LINKS.html | ||
| TEST_HTML5_MINIFIED.html | ||
| TEST_HTTP.html | ||
| TEST_INVALID_URLS.html | ||
| TEST_REPETITION_1.txt | ||
| TEST_REPETITION_2.txt | ||
| TEST_SCHEMES.md | ||
| TEST_SCHEMES.txt | ||
| TEST_STYLESHEET_LINK.md | ||
| TEST_VERBATIM.html | ||