Skip to content

Commit

Permalink
[xy] Update the file content API implementation. (mage-ai#5267)
Browse files Browse the repository at this point in the history
# Description
<!-- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
-->
Close: mage-ai#4558
Update the file content API implementation to take the whole subpath as
the argument.
When web server proxy automatically decode the url, the file content API
throws error. This PR fixes that.

# How Has This Been Tested?
<!-- Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.
-->

- [x] Tested locally with API call
`/api/file_contents/default_repo/data_loaders/file_name.py


# Checklist
- [x] The PR is tagged with proper labels (bug, enhancement, feature,
documentation)
- [x] I have performed a self-review of my own code
- [ ] I have added unit tests that prove my fix is effective or that my
feature works
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation

cc:
<!-- Optionally mention someone to let them know about this pull request
-->
  • Loading branch information
wangxiaoyou1993 authored Jul 15, 2024
1 parent fa02d73 commit 35dfa55
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mage_ai/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def make_app(
),
# Download resource
(r'/api/downloads/(?P<token>[\w/%.-]+)', ApiResourceDownloadHandler),
(r'/api/(?P<resource>file_contents)/(?P<pk>.+)', ApiResourceDetailHandler),
(
r'/api/(?P<resource>\w+)/(?P<pk>[\w\-\%2f\.]+)'
r'/(?P<child>\w+)/(?P<child_pk>[\w\-\%2f\.]+)',
Expand Down

0 comments on commit 35dfa55

Please sign in to comment.