Skip to content

Limit link file size#393

Merged
renkun-ken merged 7 commits intoREditorSupport:masterfrom
renkun-ken:limit-link-file-size
Mar 23, 2021
Merged

Limit link file size#393
renkun-ken merged 7 commits intoREditorSupport:masterfrom
renkun-ken:limit-link-file-size

Conversation

@renkun-ken
Copy link
Copy Markdown
Member

Closes #391

The main reason not to use file extension is that there are too many text file extensions so that it might not be a good idea. To keep user from following a link to a large file that might freeze the editor, we only need to avoid providing links to large files.

This PR checks file size at documentLink/resolve so that large files won't be provided links. By default, the file size limit is 16MB. User could customize it via options(languageserver.link_file_size_limit = bytes).

The reason to check file size at resolve stage is that we could let the user know that the file exists via editor text decoration (e.g. text underlined in vscode).

@renkun-ken renkun-ken requested a review from randy3k March 20, 2021 02:52
@randy3k
Copy link
Copy Markdown
Member

randy3k commented Mar 23, 2021

LGTM

@renkun-ken renkun-ken merged commit eed6f6c into REditorSupport:master Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document link should work with limited file extensions or file size

2 participants