Conversation
e2aa23e to
58921da
Compare
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request makes significant improvements to how eXeLearning extracted content is served and secured. The main changes separate the handling of HTML files (which require proxying for security and CSP headers) from static assets (which can be served directly from uploads), and update the
.htaccessrules to reflect this. Unit tests are also updated and expanded to verify the new behavior.Content serving and URL rewriting:
Updated
rewrite_relative_urlsand related methods inclass-content-proxy.phpto serve HTML files via the proxy (for CSP headers), while static assets (CSS, JS, images, fonts, etc.) are served directly from the uploads directory. Introducedget_uploads_urlandis_html_pathhelpers for this logic.Updated unit tests in
ContentProxyTest.phpto expect asset URLs to use the uploads path, and added new tests to ensure HTML/HTM links are routed through the proxy.Security and access control:
Revised the
.htaccessgeneration inclass-elp-upload-handler.phpto allow direct access to static assets but block HTML files, using mod_rewrite for fine-grained control and fallback rules for environments without mod_rewrite.These changes improve compatibility with hosted environments, prevent 403/404 errors for assets, and ensure HTML files are securely proxied for CSP and other headers.