-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Return full path URL (including .html
) on /api/v2/docurl/
endpoint
#6082
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
Conversation
.html
) on /api/v2/docurl/
endpoint
`make_document_url` had a behavior and it was returning invalid URL when the `page` argument was a docname (the case when used by the Embed API endpoint). This commit consider both cases for this attribute (filename page: index.html, or document name: config/v2) and decide if the `.html` extension needs to be added based on the builder --`documentation_type` (sphinx, sphinx_htmldir, mkdocs, etc) used for the project.
67b9775
to
d49a357
Compare
I think we should probably just pass along the actual filename into the API. |
Where? When calling The first case, would complicate all the resolution that I'm using in hoverxref extension. I'm using Sphinx internals to get the In the second case, I'm not sure if that's what we want (considering that the endpoint is named but I'm not sure that's the most correct pattern to follow, since asking the URL for a document should not include the extension on the request, but it should in the response. What do you think? |
This is an outcome of #5821 (comment) -- I think I'm mostly convinced we should move away from |
OK. I'm not familiarized that. I will take a look and come back with a proposal. Thanks for pointing this out. |
I've reading different parts of the code where I did a quick test passing the This ends up rendering to I'm thinking that's better to send both to the server and make it decide and use the one that it needs depending on the situation. What do you think? |
Yea, I think this is a good approach in the mid term, until we figure out a better way. |
@humitos of note, we also have this code in .org already, so should probably standardize it: readthedocs.org/readthedocs/projects/models.py Lines 1279 to 1289 in 7fda1c0
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
`path` is useful to build the proper URL to return since `doc` is not enough.
@ericholscher I finally added |
…humitos/full-path-url-docurl
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.
Looks good once tests pass 👍
…humitos/full-path-url-docurl
The endpoint
/api/v2/docurl/
is used in the Embed API.Since the Embed API receives a
docname
and not afilename
, the URL returned was missing the.html
at the end of the filename.make_document_url
had a weird behavior and it was returning invalid URLs when thepage
argument was a docname (the case when used by the Embed API endpoint).This commit consider both cases for this attribute (filename page: index.html, or document name: config/v2) and decide if the.html
extension needs to be added based on the builder --documentation_type
(sphinx, sphinx_htmldir, mkdocs, etc) used for the project.This PR adds the paramenter
path
to the/api/v2/docurl/
endpoint so we can decide which one to use in which case depending on what's needed. This change is backward compatible since if the newpath
is not present, everything will keep working as it was.This PR fixes this problem and makes all the links from the content returned to be accurate. See https://github.com/readthedocs/readthedocs-ext/pull/253
Requires: https://github.com/readthedocs/readthedocs-ext/pull/279