Skip to content

Conversation

omar-polo
Copy link
Contributor

niluje@ spotted that text/xml was still interpreted; so let's use the big hammer and serve all text/* stuff as text/plain to stay on the safe side.

The intent is to always show the content of the files in the UI, so we have to prevent the browser from trying to be 'smart'.

@omar-polo
Copy link
Contributor Author

i hereby approve @brmzkw commit!

omar-polo and others added 4 commits April 21, 2025 11:25
niluje@ spotted that text/xml was still interpreted; so let's use the
big hammer and serve all text/* stuff as text/plain to stay on the safe
side.

The intent is to always show the content of the files in the UI, so we
have to prevent the browser from trying to be 'smart'.
seems like we really care about being able to render HTML in the
iframe, so add a raw parameter to force text/plain but otherwise leave
it as-is.

This allows browsing a backup of a website from the UI.
There are three ways to visualize a file:
* default: detect the content type
* raw: serve the file as text/plain
* highlight: we enable syntax coloration
Instead of having two distinct parameters for ?raw and ?highlight, we
now have only one parameter ?render that is either:

* text: force Content-Type to text/plain
* auto: detect the Content-Type based on the file content
* code: enable code syntax highlighting
@brmzkw brmzkw enabled auto-merge April 21, 2025 09:25
@brmzkw brmzkw merged commit f6cf552 into main Apr 21, 2025
5 checks passed
@brmzkw brmzkw deleted the op/always-text branch April 21, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants