diff --git a/sundown/autolink.c b/sundown/autolink.c index 35b5298..07403f7 100644 --- a/sundown/autolink.c +++ b/sundown/autolink.c @@ -47,7 +47,7 @@ sd_autolink_issafe(const uint8_t *link, size_t link_len) "@", "&", "%", "#", "gemini://", "gopher://", "finger://", "ytdl://", - "/", "http://", "https://", "ftp://", "mailto:" + "/", "http://", "https://", "ftp://", "mailto:", "file:///", }; static const size_t valid_uris_count = sizeof(valid_uris)/sizeof(valid_uris[0]); @@ -298,7 +298,8 @@ sd_autolink__url( size - link_end, flags & SD_AUTOLINK_SHORT_DOMAINS); - if (domain_len == 0) + if (domain_len == 0 && + !(size >= 5 && strncmp((const char *)data, "file:", 5))) return 0; link_end += domain_len;