-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: render library assets named xblock-... #35910
fix: render library assets named xblock-... #35910
Conversation
Thanks for the pull request, @DanielVZ96! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
@DanielVZ96 Please fix the quality issue. Also, can you check where else this is used and make sure there are no other regressions? For example, I know when the drag-and-drop-v2 XBlock is accessed in the LMS (but not in Studio), it loads files like |
@bradenmacdonald I tested using both images that start with or without xblock, both in studio and lms. But when I try to copy the url in the authoring MFE I get this error (it's also happening in master so it's not related): |
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.
@DanielVZ96 Looks good 👍 I found an issue (I think it is unrelated). When I upload an image that contains spaces, it appears broken in the preview. You can go ahead and solve it here or create a new task if you want it that way.
https://www.loom.com/share/eff85c72e9b0435bb2d18a33175dbc17
- I tested this: I followed the testing instructions
- I read through the code and considered the security, stability and performance implications of the changes.
- I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
- Includes tests for bugfixes and/or features added.
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.
@DanielVZ96 Looks good 👍
# Retry with unquoted path. We don't always unquote because it would not | ||
# be backwards-compatible, but we need to try both. | ||
asset_path = unquote(asset_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.
This is to fix assets with a space / %20
in the URL right? What would break if we change to always unquote? I'd prefer to be consistent in how we handle things, and if we can quickly backport this to Sumac, it's not too late for a change like that. Nobody is using it in production yet.
CC @ormsbee
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.
I agree that we should prioritize simplicity/consistency over compatibility given that nobody's running this in production. My main question is where this translation happens. I would have expected this unquoting to happen higher up in the Django request processing–though I don't remember the specifics of how this is called, so maybe there's something preventing that? I just want to make sure that we're quoting in one place and unquoting in one place during request processing, and that we're not throwing around a bunch of paths that may or may not be quoted at various layers of the code.
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.
I'm testing this now. Turns out it still fails to render the images in the LMS. What do you guys think about splitting the whitespace-fixing code into another PR so I can test that further without affecting the "xblock-" fix?
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.
Yes, please open a separate PR for that.
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.
alright. i reverted the change and made a separate draft PR here: #35974
This reverts commit f933fdd.
I'll squash + merge this on Monday morning. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
Description
Due to static url replacement logic being too open, if you name your static asset "xblock-*", the platform fails to render those images.
This PR makes the matching more strict so it lets assets that start with "xblock" to be rendered correctly.
Supporting information
Issue: #35853
Private-Ref: https://tasks.opencraft.com/browse/FAL-3966
Testing instructions
(Make sure you are running the latest frontend-app-authoring changes, and if it still doesn't work try running provisioning)
Deadline
None