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 }}
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
"Create New File" URLs with "filename" query string parameters don't seem to work quite right #1527
The dotnet/docfx developers discovered that you can use query string parameters to pre-fill some of the values for you.
This allows that project to give end users a link that will let them overwrite the auto-generated documentation and/or add more information that isn't in the code, by creating files in an "overwrite" folder with the machine-readable name and initial contents so that the tool will be able to see that on the next run and incorporate it into the documentation site.
Specifically, the value query string parameter fills the main text box, and the filename query string parameter can be used to fill in the filename.
Issues
The value parameter seems to work just fine, but there are some issues with filename.
Goes up a level
When filename is specified at all, the last folder part of the URL seems to be ignored. Compare the following URL to the URL from above:
Workaround 2 doesn't stick through "cancel" and "back button"
So I had the idea that, instead of appending some dummy that doesn't exist, we could try duplicating the last folder in the filename query string parameter:
"Cancel" worked just fine, bringing me back to the folder that would have contained the file. Then I clicked on my browser's "Back" button (Firefox 65), and:
...darn. It seems to have ignored the path information from the filename parameter for some reason.
What we really need
What we need is a supported way to pre-fill some of the information on the "Create New File" page in order to be able to help users contribute incremental, targeted improvements to documentation that can be consumed by a tool.
Reacted by Aidan Fraser, Serhii Nahorets, Ryo Nakao, Khang, Jonathan de Bruin, Lukas Arnold, Patrick Connolly and AJ ONeal
Not sure when this was updated, but re-testing Workaround 1 now, Cancel doesn't go to a 404 anymore.
The workaround is good enough for me, but (perhaps) not for others, and I don't have any official documentation indicating that this is supported, so AFAIK it could break again, so I'll leave this open.
If someone can link to official documentation that shows how to do the "What we really need" part of the initial issue description, I'll be happy to close this.
Activity
airbreather commentedon Mar 20, 2019
I've sent an e-mail to GitHub support about a minute ago linking to this thread.
airbreather commentedon Mar 26, 2019
E-mail reply:
GitHub Staff (GitHub Developer Support)
Mar 26, 11:08 AM UTC
Hey Joe,
Thanks for reaching out!
We'll pass your request onto the team to consider.
I can't promise if or when we'd add full support for pre-filled new file creation parameters but we'll make sure the request is in the right hands.
Cheers
GitHub Support
llwt commentedon Apr 21, 2020
One way around I I just stumbled across that seems to work is to put the whole path into
?filenameand remove the base:Ensure to generate file creation URL (#635)
Append dummy path to file creation URL (#637)
airbreather commentedon Oct 2, 2020
Not sure when this was updated, but re-testing Workaround 1 now, Cancel doesn't go to a 404 anymore.
The workaround is good enough for me, but (perhaps) not for others, and I don't have any official documentation indicating that this is supported, so AFAIK it could break again, so I'll leave this open.
If someone can link to official documentation that shows how to do the "What we really need" part of the initial issue description, I'll be happy to close this.
airbreather commentedon Oct 2, 2020
That's essentially Workaround 2 and has the same "Cancel --> browser Back button" problem on my machine.
coolaj86 commentedon Jul 26, 2021
Has anyone figured out a method like this for gist.github.com?
Update from Github Team member: https://twitter.com/JasonEtco/status/1419703200450588685
(it may come down the pike soon)