Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.8k
fix: Cannot serve off/.../index.html#1372
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix: Cannot serve off/.../index.html#1372
Uh oh!
There was an error while loading.Please reload this page.
Conversation
vercelbot commentedSep 12, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect:https://vercel.com/docsify-core/docsify-preview/1nszbjtkr |
codesandbox-cibot commentedSep 12, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This pull request is automatically built and testable inCodeSandbox. To see build info of the built libraries, clickhere or the icon next to each commit SHA. Latest deployment of this branch, based on commitd94d259:
|
The e2e tests are reported by CI as failing, but are passing locally for me. |
anikethsaha left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks a lot for fixing the bug.
It does seems to work and fixes the issue.
Few questions
- It would be great to have some more test cases.
- it would be great to have some comments for why we are doing those normalizing and those conditional check. May be linking to the issues/PR will work as well.
Also, I doubt this might be a semver-major as it can be a breaking change. cc @docsifyjs/reviewers
@anikethsaha Thanks for the feedback. Could you clarify what sort of test cases you are looking for? I notice you have Cypress and unit tests. Which would you prefer, and where would they go exactly? |
anikethsaha commentedSep 15, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
You could add cypress tests for other links like
Also if there are other cases you think you can add |
Done, let me know if they're sufficient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM 🎉
My only concern is whether this should be considered as breaking or not!
It shouldn't be breaking, it's an additive change. You could argue that any breakages would be bugs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@anikethsaha I think when it is not sure if it is a breaking change, we can make it as an option.
Giving theswitch button to users' hands.:)
rgladwell commentedSep 17, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmmm I think this change breaks live reloads in development mode. |
I agree that it is not a breaking change as it was a bug so probably it wasn't used before in order to avoid the bug. |
Been trying to add a feature flag for this, but the code is getting very complicated. If this isn't a breaking change, can we live without it? |
cc @docsifyjs/core |
Hey@rgladwell, Thanks for the PR! We recently merged#1276 into |
c375219 tod7cae0eCompareIs there some way to get a screenshot or run non-headless for the Jest e2e tests? |
Docsify must be hosted on a server that supports a default directoryindex (i.e. maps `/.../` -> `/.../index.html`).Some platforms do not support this, however. For example, HTML appshosted on the popular game/software platform, Itch.io.This change supports hosting Docsify off an explicit path file, such as`/index.html`. It does this by: 1. Adding handling for paths like `index.html#/blah`, and 2. Normalising paths with fragments back to markdown pathsFor example, `http://example.org/index.html#/blah` would be mapped to`http://example.org/blah.md`.Thisfixes:docsifyjs#427
@jhildenbiddle@anikethsaha@Koooooo-7 As requested, added e2e tests using Jest framework. |
Uh oh!
There was an error while loading.Please reload this page.
sy-records left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM.
note: Please usesquash and merge for merging
/.../index.html/.../index.htmlThanks! |
Uh oh!
There was an error while loading.Please reload this page.
Summary
fixes#427
Docsify must be hosted on a server that supports a default directory index (i.e. maps
/.../->/.../index.html).Some platforms do not support this, however. For example, HTML apps hosted on the popular game/software platform, Itch.io.
This change supports hosting Docsify off an explicit path file, such as
/index.html. It does this by:/index.htmlpart of the path being removed during routing, andFor example,
http://example.org/index.html#/blahwould be mapped to the markdown source filehttp://example.org/blah.md.This fixes:
#427
What kind of change does this PR introduce? (check at least one)
If changing the UI of default theme, please provide thebefore/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx], where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding anew feature, the PR's description includes:
To avoid wasting your time, it's best to open afeature request issue first and wait for approval before working on it.