Skip to content
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

Middle slash removed by "replace" #54

Closed
philngo opened this issue Feb 8, 2016 · 5 comments
Closed

Middle slash removed by "replace" #54

philngo opened this issue Feb 8, 2016 · 5 comments
Labels
Milestone

Comments

@philngo
Copy link

philngo commented Feb 8, 2016

In an DRF router endpoint I'm seeing the following behavior:

url(r'^api/v1/', include(router.urls)), # becomes "apiv1" in DRF docs output

Not sure exactly sure why slashes are being replaced on this line, but perhaps a strip('/') than replace('/','')would be more appropriate, as that would preserve slashes in the middle, like I need.

https://github.com/ekonstantinidis/django-rest-framework-docs/blob/9a85323c4147ec4ebb754a8b0373c956ee89b821/rest_framework_docs/api_endpoint.py#L1

Happy to make a PR

@manosim
Copy link
Owner

manosim commented Feb 10, 2016

Hello @philngo! I've opened a PR to cover the case where:

url(r'^', include(router.urls)),

It would be great if you can check whether this works for your project. Thank you!

Update
Forgot to mention that the PR is #56.

@manosim manosim added the bug label Feb 10, 2016
@manosim manosim added this to the Release 0.0.7 milestone Feb 10, 2016
@Laptopmini
Copy link

I have the same problem. Tried the code from PR #56 but it did not solve it.

@manosim
Copy link
Owner

manosim commented Feb 13, 2016

@philngo @Laptopmini Can you provide me with a urls.py example so I can reproduce this issue? Additionally feel free to open a PR!

@Afnarel
Copy link
Contributor

Afnarel commented Feb 24, 2016

Hi! I just created the pull request above (PR #64 ) which should fix the issue.
I had the same problem and it is now working properly.

The pull requests removes only leading and trailing slashes from the parent URL instead of removing all slashes.

@manosim
Copy link
Owner

manosim commented Feb 24, 2016

@Afnarel 's PR is now merged so it should be fixed now 👍

@manosim manosim closed this as completed Feb 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants