Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail for references to files outside of the repo #138

Closed
dcastro opened this issue Sep 9, 2022 · 0 comments · Fixed by #152
Closed

Fail for references to files outside of the repo #138

dcastro opened this issue Sep 9, 2022 · 0 comments · Fixed by #152
Assignees
Milestone

Comments

@dcastro
Copy link
Member

dcastro commented Sep 9, 2022

Clarification and motivation

Given the following file structure:

- /dev/
  - repo1/
    - a.md
    - b.md
  - repo2/
    - c.md

Say the file a.md in repo1 contains a reference to a file in repo2, e.g. [some text](../repo2/c.md).

At the moment, if I run xrefcheck in repo1, it'll succeed - but it shouldn't.

The link in a.md points to a file outside of the repo's root (/dev/repo1). When the repo is pushed to github, and the markdown file is rendered by github, the link will be broken.

As such, xrefcheck should report this link as broken.


Additionally, pretend a.md had a link such as ../repo1/c.md.

Locally, that path does point to a file inside the repo root. However, that won't work when the markdown file is rendered by github.

We should report this type of links as broken as well.

Same for ../repo2/../repo1/c.md and similar shenanigans.


Note: the error message should be very clear about why this link is being reported as broken.

Acceptance criteria

  • Links that point to files outside the repo are reported as broken.
@dcastro dcastro added this to the 0.2.2 milestone Sep 9, 2022
@dcastro dcastro assigned dcastro and Sorokin-Anton and unassigned dcastro Sep 15, 2022
Sorokin-Anton added a commit that referenced this issue Sep 16, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories

Solution
Sorokin-Anton added a commit that referenced this issue Sep 19, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories
Sorokin-Anton added a commit that referenced this issue Sep 23, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories
Sorokin-Anton added a commit that referenced this issue Sep 26, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories
Sorokin-Anton added a commit that referenced this issue Oct 3, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories
Sorokin-Anton added a commit that referenced this issue Oct 10, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories
Sorokin-Anton added a commit that referenced this issue Oct 10, 2022
Problem: as in #138, when we see a local link, we are checking only
existance of referred file,
not checking that this file is a part of repo
and link will compatible with Github's renderer

Solution: manually count "nesting levels" of all local links,
checking that number of `".."`'s is always less
then number of real directories
Sorokin-Anton added a commit that referenced this issue Oct 10, 2022
…utside-repo

[#138] Report links that escape repo directory
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 a pull request may close this issue.

2 participants