Closed cbuteau closed 6 years ago
I don't 100% follow this, but getting a 404 doesn't sound like a credential/cookie problem.
It sounds to me that the URL being requested from the markdown (which doesn't work) is not the same as the URL being requested when you paste a URL into the address bar.
Could you use your browser's developer tools to check what the exact URL which gets 404'd is?
To give more context. I am using Bonobo to store internal scripts and I thought I could create a wiki space for the team since the Markdown formatting looked pretty solid.
So I created another repository and started pushing updates to it. First thing...refering to other pages needs the repository GUID to actually work.
So this link (Click me)[./some/subpage.md]
Looks like this
(Click me)[
But to answer your question.... That is the url I test and download with... the one that it requests and is given the 404.
So while I am viewing this page... http://ag-wal-hqodev01/Bonobo.Git.Server/Repository/Blob/6724d3bb-51b4-4a4a-8045-69e4bcf28ba9?encodedName=master&encodedPath=cbu1/images/cmder.png
Which wraps some HTML around the image for display and then downloads the image from the Raw url...it will download the Raw link....
But in the context of the MarkDown that is translated to HTML it always fails with a 404 and I display my alt text in the Markdown.
But this is what the headers look like so it looks like it gets some cookies appended and the referrer is the other page I am accessing.
GET http://ag-wal-hqodev01/Bonobo.Git.Server/Repository/Blob/6724d3bb-51b4-4a4a-8045-69e4bcf28ba9/master/Raw/cbu1/images/cmder.png HTTP/1.1 Host: ag-wal-hqodev01 Proxy-Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36 Accept: image/webp,image/apng,image/,/*;q=0.8 Referer: http://ag-wal-hqodev01/Bonobo.Git.Server/Repository/Blob/6724d3bb-51b4-4a4a-8045-69e4bcf28ba9?encodedName=master&encodedPath=cbu1/cmder.md Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8 Cookie: atlassian.xsrf.token=BEM7-NWMG-UHOW-LG3F|a1f1624b2814799d39a1d5c4a2f6567b9fd11f79|lout; ASP.NET_SessionId=omd4vxbreizwgeetuvwloazx; .AspNet.Cookies=ufN8LSXqMfPkC5M_sZUhaOc0VvCqWyDKazfQuHqj-MC1lbxLrT63XSbAaPchW_07Mxzv3VOO7bm6D8CHQ9rD29XXPKxaKAyEIECJ1xcgYCCqBU49lG-GXR5OD3BhQBOHbdPHyKhlotqZ8F-fsxov1iTeIJgJg2Q9VTZ4fmTjEscdfcE5OQCEbraznia_HaOUZ7lnXq2JpYb2vPBe9C3kMlygiHxANv5YKVLc8TmBzk0vqFtquGIXkl_873Z3aNHY2z9j0_oZK0GJWAlUXzHmB--d2vuYcbyxc9gGbX6cLgrEbdNtG75ApJi0PKROc2qk0hByA5tVhiZ8mhWy3DfKtvCnvT_ZAa-gqmx9olHJFL5cPIkp53r0kwyVtAVtTklRfZdGytJalLANOvF0_pM85kivs_xmCsHdWTRU50DuooxOAWzTNfDXJhW7fGiBO5bDBcxfwbFtYIPk_VuMlU7_gsdnAUHiaaJ9QwARIajVNAhnDPL_bXf9Cro_IgHX0Pt6NrSAVJO37dakKW4GJ8hHT3ob5QUaXQgt6yBA3zLtE9E; JSESSIONID=1166FDD65937AFA58C9952792A902215; __RequestVerificationToken_L0Jvbm9iby5HaXQuU2VydmVy0=wkRRvHhZ7iaLG4FV83xOUDJnsxEOr6ZiJ7I38dp35G3b8JJvDPBTVMFwVlrYl7txRIRSrS-0Ybkcg82q2ckNsxsj8oNS3r6vR3z_BVnBDBQ1 DNT: 1
I am thinking it might be just a IIS configuration thing rather than the actual code.
Is there anyway I can see traces for the ASP.NET app to confirm it is the one 404'ing me instead of the IIS level?
Given a repo with the following structure root | - readMe.md | - license.txt | + mdwikis | | - readme.md | | - test.md the md file links expect a url of http://localhost:55404/Repository/ad6e5bcd-70da-434c-bb36-1713e86bf218/master/mdwikis/readme.md and http://localhost:55404/Repository/ad6e5bcd-70da-434c-bb36-1713e86bf218/master/mdwikis/test.md to resolve to the files, but they dont.
The acutal urls would be http://localhost:55404/Repository/Blob/ad6e5bcd-70da-434c-bb36-1713e86bf218?encodedName=master&encodedPath=mdwikis%2FReadMe.md
This is appears to be a route mapping issue that would need some attention.
Sorry, I am being very dense here, but can you not just put the proper URL into the markdown?
As you've discovered, there is more information in the URL than just the filename - Bonobo needs branch information too, and it's also quite a challenge to map all legal filenames into legal URLs, which is why the branch name and file name travels as a query parameter rather than just a portion of the URL.
To be honest, I don't think Bonobo is trying to be a web-server - you might be better just arranging something else to serve a bunch of static .MD files.
Putting the full url means it it translated to a partial in the HTML. It then does the fetch...and then fails.
The idea is to take advantage of md.
I tried other md engines to no luck MDwiki although clever just goes out to lunch on some pages. Maybe I should look into a md precompiler or building my own node MD app from scratch.
I have moved to scripts that generate the html from md. I might figure out automation later.
I am using the converter from showdown https://github.com/showdownjs/showdown
It allows me to modify the links to the other md files to end with .html instead with a regex field.
I think I will leave this open and let the team close it inactive. It is not a bad idea.
As well as setting up a source repository you could setup a document repository.
But Bonobo already is so popular. I found several SO articles to get me through the install.
So in summation. If a hierarchy of md files are checked in...they can reference each other through relative links if the link includes the repository information. However images fail to load...relative paths generate the correct Raw url to fetch them. Full urls are translated into relative urls which also perform the fetch of the Raw url and get a 404.
You can probably do images if you reference full urls to completely different source.
I also setup a documentation repository that utilizes markdown. I had to specify links using root-based paths (no need to worry about the hostname then, at least). This is because Bonobo uses very different url schemes depending on if you are in the repo root browser view, repo subdirectory browser view, file browser view, or the file raw view.
E.g:
Repo root browser view:
/Bonobo.Git.Server/Repository/Tree/83e38204-0280-4eff-83b4-64a1412130a0Repo subdirectory browser view:
/Bonobo.Git.Server/Repository/83e38204-0280-4eff-83b4-64a1412130a0/master/Tree/imagesFile browser view:
/Bonobo.Git.Server/Repository/Blob/83e38204-0280-4eff-83b4-64a1412130a0?encodedName=master&encodedPath=images%2Fgit-setup-windows_credential_store.pngFile raw view:
/Bonobo.Git.Server/Repository/83e38204-0280-4eff-83b4-64a1412130a0/master/Raw/images/git-setup-windows_credential_store.png
As you can see this $#!t is just as inconsistent as can be! File in the URL path, file in the URL query, branch in the URL path, branch in the URL query, GUID before the view type, GUID after the view type. This makes using relative URLs that cross views absolutely impossible.
I'm not sure how complicated it would be to address this. The URL-rewrite module in IIS with some rules may be one way to locally create a solution, but otherwise the entire way that Bonobo handles URLs may need to be changed to make it consistent.
@Nu11u5 It's a mess because A) all sorts of people have played around with it and their contributions haven't always been as firmly reviewed as they might have been and B) nobody has seen acting as a web-server as much of a priority, so the consistency of the URLs hasn't been a big deal.
Of the four URLs you post, only two are actually for an individual file - is there a reason why the "raw file view" wouldn't work in this application?
@willdean Oh sure the "raw file view" works fine for embedding an image in markdown if you use the full/root path. That path can't be reconciled with the other view URLs which is where you would be when viewing rendered markdown, so relative URLs cannot be used which was @cbuteau's issue.
there's a bug in the route mapping- there is a constraint on the blob mapping that tries to forces the id to be only digits, except the id is a guid. This is why the branch/path is in the query string instead of part of the proper url.
It doesn't solve the problem 100%, but it will help
Hi there! I could open a new ticket, but this one seems relevant. Need some help in my issue: visibility of images used in readme.md. Images are being shown for logged-in users, but when I set a repo as anonimous - non-logged-in users can't see any images - only alt-text.
I've actually gone to embedding images in the document using ![text][ref-id]
image references so I can avoid the URL issues. Then I put the base64 encoded image at the end of the document in [ref-id]:data://...
. Makes the .md file larger but Git has no problem with it.
HI everyone I opened the issue and I think I will close it.
The purpose is to be a git server and not a doc repository. I have moved on from that and done a quick script that runs all the files through showdownjs and moves them to a static IIS site. I think relative images ended up working this way. I think I had to write a plugin for pages that refereed to other pages to replace md with html.
If you want to ask me details DM me. It is stuff I did for work so I can describe it but not upload source.
Hello,
I got your server up and running on IIS on a Win 7 server machine. The only trick was installing .Net 4.6...the installer for 4.5 stupidly said...Already installed exiting. But I found the 4.6 trick on someone else's blog.
I am trying to host wiki pages in markdown format but cannot seem to get embedded images to work. I tried relative paths and absolute paths and it does not work.
Like I have this in the markdown...
and the HTML is this.
But it gets a 404 accessing the full URL of the image.
If I plug the url into the addressbar it downloads the file.
Is there some extra hack to ensure it carries some credentials or cookies forward in its request for the image?
If you resolve this you could also advertise as "look you can use it as a markdown doc repo" just include repo id in links to images and other docs.