Skip to content
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

Error on mobile but not desktop #31

Open
nickian opened this issue Jul 12, 2024 · 5 comments
Open

Error on mobile but not desktop #31

nickian opened this issue Jul 12, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@nickian
Copy link

nickian commented Jul 12, 2024

I have a very simple request block that just renders some basic HTML:

url: https://mysite.com/page.php
res-type: md
render

This works fine on desktop Obsidian. In mobile, the blocks do not render and show this error:

Error: undefined is not an object (evaluating 'responseData.headers["content-type"].includes')

This same URL used to work fine in mobile, but something changed with an update. Is there some specific header the PHP script needs to output for this to work?

@Rooyca Rooyca added the bug Something isn't working label Jul 12, 2024
@Rooyca Rooyca self-assigned this Jul 12, 2024
@Rooyca
Copy link
Owner

Rooyca commented Jul 12, 2024

Have you try to run it without the res-type and/or without render?

This may be caused by the sanitizer (not sure, just my first hypothesis). I don't know how to recreate this behavior.

@Rooyca
Copy link
Owner

Rooyca commented Jul 13, 2024

Hello @nickian,
It seems that only these tags are allowed, although it is strange that it works on desktop but not on mobile.

@nickian
Copy link
Author

nickian commented Jul 13, 2024

It seems to be doing the same thing when I remove res-type and render.

I think I'm only using tags on that whitelist. I have a script that makes a request to Coin Market Cap to get crypto prices and it just outputs this:

echo '<div style="display:block; width:100%;">';
echo ' <img src="btc.png" width="15"/> ';
echo '<strong>BTC</strong>: $'.number_format(round($response['data'][1]['quote']['USD']['price'], 2), 2). ' ('.round($response['data'][1]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)';
echo '</div>';

echo '<div style="display:block; width:100%;">';
echo ' <img src="eth.png" width="15"/> ';
echo '<strong>ETH</strong>: $'.number_format(round($response['data'][1027]['quote']['USD']['price'], 2), 2). ' ('.round($response['data'][1027]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)<br/>';
echo '</div>';

echo '<div style="display:block; width:100%;">';
echo ' <img src="doge.png" width="15"/> ';
echo '<strong>DOGE</strong>: $'.number_format(round($response['data'][74]['quote']['USD']['price'], 2), 2). ' ('.round($response['data'][74]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)<br/>';
echo '</div>';

echo '<div style="display:block; width:100%;">';
echo ' <img src="shib.png" width="15"/> ';
echo '<strong>SHIB</strong>: $'.number_format($response['data'][5994]['quote']['USD']['price'], 8, '.', ''). ' ('.round($response['data'][5994]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)';
echo '</div>';

@Rooyca
Copy link
Owner

Rooyca commented Jul 13, 2024

Inside a <?php> tag? If the endpoint returned only the html I think there would be no problem.

@Rooyca
Copy link
Owner

Rooyca commented Jul 14, 2024

I'm thinking of adding a way to turn HTML sanitizing on and off, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants