-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Git LFS image linking not possible #5746
Comments
The problem is that we may need the raw route to still actually give the raw file pre-smudge... I hate to say it but what does github do? |
I made a quick repo on github. That seems to work fine. The first image is in LFS, the second one is not. Also note that when you go to the LFS image file, it doesn't ask you if you want to see the raw file and actually displays the image. (https://github.com/diondokter/LFS-Test/blob/master/TestImage.jpg) |
OK, so github's raw does provide the pointer. https://raw.githubusercontent.com/diondokter/LFS-Test/master/TestImage.jpg So we probably shouldn't change the results of the raw url. Could you tell me how you linked the image - I'm not quite sure how our wiki works. |
If you go to the raw readme file, you can see how it's linked. It's the same in Gitea as it's standard markdown. https://raw.githubusercontent.com/diondokter/LFS-Test/master/README.md When going to the image itself in the browser, it seems the lfs image and the normal image use different subdomains. I guess that the markdown renderer realizes that the image was an lfs image and links to a different path. In the meanwhile, lfs images are also hosted on the server as actual images. |
So we just link using |
A normal link is: Here's a markdown cheatsheet: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet |
OK
Now most of the work to do the lfs download is already in the editor somewhere because I know we detect if a file is LFS and ask if you want to download the LFS version. |
|
OK, if you can could you try building from #5787 and test if that solves your problem? |
Ah I've just noticed something very disturbing... If you try to commit an LFS pointer file just as a random file https://github.com/go-gitea/gitea/blob/master/routers/repo/view.go#L185 will mean that it gets assigned as an LFS file. |
The correct thing is to query the git attributes then the file |
Does it though? |
OK, you have two repositories A and B, A has lfs set up and you commit a file F.jpg which gets pointered to P.jpg. B doesn't have lfs set up, and you manage to get a copy of the pointer file P.jpg and commit that. On gitea this file P.jpg when browsing B will be said to be a Git LFS file - even though it isn't and my patchset will display P.jpg as a jpeg although when you clone B you won't get any filtering as B doesn't have git-lfs set up. Similarly, there's a weirdness in github's interface - if you delete the .jpg from the .gitattributes then technically those files stop being lfs - however, github will continue to show them as if they're LFS - they must be storing the filename with the lfs status - which I guess is safe than relying on parsing gitattributes as there may be filters other than lfs that actually end up with adding stuff to the lfs. |
I don't thint gitattributes should be taken into account |
Hmm, I think .gitattributes and the lfs filter is really the only thing we've really got to detect if a file is LFS or not. I suppose you could come up with another filter with a different name than the default but then you're at the point of making things so difficult for everyone that your repository is very special indeed. I suspect for my current patchset #5787 it's probably reasonable to assume that if it looks like a pointer, just check if the LFS Oid is in that repository and if so, show it as the object. |
This PR makes it possible for the markdown renderer to render images and media straight from the LFS. Fix #5746 Signed-off-by: Andrew Thornton [[email protected]](mailto:[email protected])
[x]
):Description
When linking to an image that is stored in LFS, you get the LFS text. For example:
https://mywebsite.com/diondokter/myrepo/raw/branch/develop/Design/Images/myimage.jpg gives
When linking to the image in markdown, it will not appear which is quite inconvenient.
Can this be resolved?
I can't repro this issue on try.gitea.io because (I suspect) LFS is turned off.
The text was updated successfully, but these errors were encountered: