You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Improve this Doc" URL goes back to a 404 when canceling out #3156
Write a .NET project on GitHub with at least one interesting member that can get an "Improve this Doc" link.
Generate API documentation for that project.
Browse the API documentation.
Click an "Improve this Doc" link.
Click the "Cancel" link near the top.
Expected Behavior:
You should be punted back to the overwrite directory that the file would have been created in, same as if you got to the "Create new file" page by clicking the button while browsing the overwrite directory on GitHub.
This may very well be a bug on GitHub's side, but I wanted to start here in case we think there's something we can do with the URL to make it work the way a user might expect it to.
Ahh -- it appears that I only immediately see "Cancel" when logged in as someone with push access to the repo!
The equivalent page shows up when you click "Fork this repository and propose changes", and the same thing happens when I click "Cancel" there... tested on some random page for docfx:
Specifically, that was FileMappingItem --> Improve this Doc, which should (for someone with push access to dotnet/docfx) give what I saw on mine, which should (I think) punt you back to this, which 404s.
This should be a repo config issue. When you click cancel, GitHub will lead you back to the directory you just try creating. If it does not exist, it will be 404.
To resolve this, you shall ensure the directory doc/overwrite/ exist in your repo. Of course, git does not support create an empty directory. You can add a placeholder file in it.
To resolve this, you shall ensure the directory doc/overwrite/ exist in your repo. Of course, git does not support create an empty directory. You can add a placeholder file in it.
I think this is probably a GitHub bug. Removing all the query parameters and the final "/new" gives me a link like this, which works exactly as I expect it to work (of course, without the special name and contents that docfx require in order for it to do what we're trying to do):
As soon as I add the "filename" query parameter, it seems to go up a level.
I was able to manually come up with a URL that does work the way I wanted it to, however: changing overwrite/new?filename=whatWeGenerateNow to overwrite?filename=overwrite/whatWeGenerateNow like so:
As soon as I add the "filename" query parameter, it seems to go up a level.
My investigation stuck here before. So I added the final /new to make it work. It is really interesting that duplicating overwrite can get a perfect URL! BTW, I also feel it like a GitHub bug.
You can try customizing template to make it work. Welcome to contribute back 😄 Related code:
Yeah. I just played around with it a little bit more, and if I click cancel and then use the Back button on my browser (Firefox 65), GitHub starts ignoring that part of the filename=, which causes me to start editing doc/TheFilename.md instead of doc/overwrite/TheFilename.md like I was before.
I've opened isaacs/github#1527, and I'll be e-mailing GitHub support with a link to this issue shortly. Follow that issue for any updates on that side of things.
Activity
airbreather commentedon Aug 4, 2018
This may very well be a bug on GitHub's side, but I wanted to start here in case we think there's something we can do with the URL to make it work the way a user might expect it to.
herohua commentedon Aug 5, 2018
@airbreather , I did not see a "Cancel" link on the page with the "Improve this Doc" link:

Could you provide more information?
airbreather commentedon Aug 5, 2018
Ahh -- it appears that I only immediately see "Cancel" when logged in as someone with push access to the repo!

The equivalent page shows up when you click "Fork this repository and propose changes", and the same thing happens when I click "Cancel" there... tested on some random page for docfx:

Specifically, that was FileMappingItem --> Improve this Doc, which should (for someone with push access to dotnet/docfx) give what I saw on mine, which should (I think) punt you back to this, which 404s.
stale commentedon Mar 6, 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.
airbreather commentedon Mar 6, 2019
Thank you, friendly bot, for doing your part to help keep repositories clean.
This still appears to be an issue in the latest stable release (2.40.11).
superyyrrzz commentedon Mar 20, 2019
This should be a repo config issue. When you click
cancel, GitHub will lead you back to the directory you just try creating. If it does not exist, it will be 404.To resolve this, you shall ensure the directory
doc/overwrite/exist in your repo. Of course, git does not support create an empty directory. You can add a placeholder file in it.airbreather commentedon Mar 20, 2019
That doesn't seem to be enough, unfortunately. I do have a
.gitkeepfile here: https://github.com/NetTopologySuite/NetTopologySuite.IO.GPX/tree/master/doc/overwrite however, links such as this cancel back to this.It looks like the problem is that the links on pages such as this one use the following format:
Which cancels back to:
When exploring around, I noticed that I can change
overwrite/new?filenametooverwrite/.gitkeep?filename, like so:Then the "cancel" link puts me to the dummy file I created in my "overwrite" folder:
I think this is probably a GitHub bug. Removing all the query parameters and the final "/new" gives me a link like this, which works exactly as I expect it to work (of course, without the special name and contents that docfx require in order for it to do what we're trying to do):
As soon as I add the "filename" query parameter, it seems to go up a level.
I was able to manually come up with a URL that does work the way I wanted it to, however: changing
overwrite/new?filename=whatWeGenerateNowtooverwrite?filename=overwrite/whatWeGenerateNowlike so:Brings me to a page that works exactly as I expect it to.
superyyrrzz commentedon Mar 20, 2019
@airbreather Thank you for the experiments!
My investigation stuck here before. So I added the final
/newto make it work. It is really interesting that duplicatingoverwritecan get a perfect URL! BTW, I also feel it like a GitHub bug.You can try customizing template to make it work. Welcome to contribute back 😄 Related code:
docfx/src/docfx.website.themes/common/common.js
Line 86 in a977d26
airbreather commentedon Mar 20, 2019
Yeah. I just played around with it a little bit more, and if I click cancel and then use the Back button on my browser (Firefox 65), GitHub starts ignoring that part of the
filename=, which causes me to start editingdoc/TheFilename.mdinstead ofdoc/overwrite/TheFilename.mdlike I was before.airbreather commentedon Mar 20, 2019
I've opened isaacs/github#1527, and I'll be e-mailing GitHub support with a link to this issue shortly. Follow that issue for any updates on that side of things.
airbreather commentedon Oct 2, 2020
Not sure when this was updated, but the "Cancel" button now returns me back to the repository's home page, which I think is good enough.