Skip to content

Viewing resources returning internal server error. [status code 500.] #11774

Answered by xnpltn
sadlrxn asked this question in Q&A
Discussion options

You must be logged in to vote

set csp to null,
then add call register_uri_scheme_protocol on builder:

            .register_uri_scheme_protocol("asset", |_ctx, request| {
                let cleaned_path = percent_encoding::percent_decode_str(&request.uri().path())
                    .decode_utf8()
                    .unwrap()
                    .as_bytes()[1..]
                    .to_vec();

                let path_string = String::from_utf8(cleaned_path).unwrap_or_default();
                let path = std::path::Path::new(&path_string);
                match std::fs::read(path) {
                    Ok(data) => {
                        let content_type = if let Some(ext) = path.extension() {

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by sadlrxn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants