-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
fix: When alias contains parameters, append ext error #1855
base: develop
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1c5a0cb:
|
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.
In line 85, it seems a typo bug
.
: `${path}${ext}`; | ||
: path.indexOf('?') === -1 | ||
? `${path}${ext}` | ||
: path; |
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.
We need to handle all URLs the same with or without the query, just like regular HTML in a browser.
For example, /path/to/folder/?foo=123
has a query, and we still need to look for /path/to/folder/README.md?foo=123
, but this skips anything with a query.
In the end, we need to operate on the path separately, and always send the query with the final result.
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.
@trusktr, is there anything that could help push this along? I'm not that familiar with js but I am good with regular expressions. If you can provide a little more context on the issue perhaps I could put a little time into it, as fixing this would open up a lot of doors for those of us needing to federate markdown files from private repos/orgs on GitHub.
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.
@vergilcw sorry for late reply. I think the solution should determine the fully qualified URL (f.e. anchor.href = partialUrlString; const fullyQualifiedUrl = anchor.href
) and then use a new URL
object to get all the pieces and use them correctly.
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.
See comment. Basically this still has other problems. The solution is to handle paths and queries separately
|
@SumithChandran hi, sorry for taking long. Did you find a solution? I commented on a direction we should look at. We just need to handle all the URL parts correctly, f.e. get all the parts of the URL, do what we need with only the path part, then put everything back together properly. |
@trusktr , no I haven't found anything solution. |
Any chance this will get done soon? I've actually never committed to a public repo, but this looks pretty straightforward. I'd be willing to try. |
@zomgbre willing to take a stab at it? We haven't circled back yet |
Summary
As mentioned in #1854, if the URL used by the alias contains parameters, we will add the 'ext' configuration item incorrectly
What kind of change does this PR introduce?
Bugfix
For any code change,
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
Related issue, if any:
Fix #1854
Tested in the following browsers: