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

Incorrect Commit Hash Linking #7273

Closed
1 task done
jag3773 opened this issue Jun 20, 2019 · 10 comments
Closed
1 task done

Incorrect Commit Hash Linking #7273

jag3773 opened this issue Jun 20, 2019 · 10 comments

Comments

@jag3773
Copy link

jag3773 commented Jun 20, 2019

Description

Gitea is linking the Croatian word for alphabet (abeceda) to a non-existent commit hash in Markdown files. For example, see https://try.gitea.io/jag3773/testing/src/branch/master/README.md . The links therein point at https://try.gitea.io/jag3773/testing/commit/abeceda .

Screenshots

Screen Shot 2019-06-20 at 1 45 34 PM

@zeripath
Copy link
Contributor

It'd also do it to deadbee feedbee dadbeef acefeed acebeef and so on...

@zeripath
Copy link
Contributor

I guess the problem is how to detect whether these are valid short shas. I wonder if when rendering the comment GitHub is checking if the codes are valid short shas eg de9b398 should be a valid short sha but I suspect that de9b398d isn't

@zeripath
Copy link
Contributor

What we really need is a way of telling Gitea not to process some of these things it auto processes. Personally I'd be a fan of a preceding \ but I don't know how easy that would be to implement

@mrsdizzie
Copy link
Member

Github does check if they are actual commits or not, which I think is the only real solution to this -- though that probably means some sort of DB lookup when rendering matches. Not sure if that is possible/reasonable within the current way of doing things? I know there has been an effort to avoid that.

These are really a problem with blocks of existing text, and having to always edit anything that matches a pattern and actually modify the contents so it doesn't generate a link doesn't seem like a solution.

@jag3773
Copy link
Author

jag3773 commented Jun 21, 2019

Another workaround idea would be to only check for commit hashes in issue threads and not in regular markdown files in the repository–operating on the theory that it's less likely you'll be referring to a commit hash in your markdown files. Of course, that could be changing behavior that someone may be relying on?

@mrsdizzie
Copy link
Member

That would just trade one problem for another (and original problem would still exist in issues). Checking that the hash exists would need to be the final solution for this I think

@zeripath
Copy link
Contributor

zeripath commented Jun 21, 2019

I still think that we need some way of telling Gitea not to try to interpret these. Sometimes you just want to refer to \#1 (and not issue #1). I don't even know how to stop this on GitHub!)

@mrsdizzie
Copy link
Member

Yes agree, and that is the downside of auto linking in the first place :(

Most people probably don't want to modify their content as it would look strange in any other context (a text file that now has a bunch of \#1 in it). Again, if you are typing new content its easier to avoid by maybe putting a space or including a code block, but most people probably aren't going to want to modify all of their existing docs, text, etc... We could probably introduce a class that doesn't get run through the processor (link links and code now) and people could put blocks of text within that so it would be a little cleaner at least.

Though I think that is separate, as most of these issues are about creating links where there shouldn't be any (and pointing to a non existent commit/issue) rather than trying to disable it when it would otherwise be wanted.

@stale
Copy link

stale bot commented Aug 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Aug 22, 2019
@jag3773
Copy link
Author

jag3773 commented Aug 22, 2019

This seems to be fixed on the running build of try.gitea.io (Gitea Version: 1.10.0+dev-199-g9f58187f1)!

@jag3773 jag3773 closed this as completed Aug 22, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants