-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
rewrite relative paths in HTML export #1907
base: main
Are you sure you want to change the base?
Conversation
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.
Is this the best approach to this? I feel like since we already run all HTML pages that pretalx serves through a parser anyway, wouldn't it be better to use the parsed information to find URLs to replace?
In any case, we should take this action only on pretalx-generated HTML (and CSS, where needed – we already find URLs in CSS via find_urls
. By checking the output for "DOCTYPE html", you a) potentially increase the runtime by a lot, because if that string is not present, the whole potentially very long string will be checked, and b) you'll match e.g. user-uploaded HTML and rewrite it, which we really should not do.
(a) could be alleviated by only checking content[:20]
for the substring match, but b) still stands …)
Quite certainly not! This is a hack that tries to work on short notice. |
8ab4ae0
to
04b5704
Compare
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 wonder if it wouldn't be cleaner to ask the user to provide a prefix that we can then supply to the functions here. It could be used with settings.FORCE_SCRIPT_NAME
to make static files appear at the correct location (potentially) without laboriously having to rewrite all static files to relative paths. Would have to test if this works correctly, including adding support to EventUrl
etc for this, but if that can be made to work, it’d be infinitely prefereable to regex-parsing HTMLs for URLs, imo.
This PR addresses issue #1900. It does so by rewriting absolute paths in exported HTML files.
Additional absolute paths still exist e.g. in exported javascript and must be rewritten as well.
This is missing (at least):
schedule/nojs
toschedule/nojs/index.html