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

Canned query ?sql= is pointlessly echoed in query string starting from hidden mode #1411

Closed
simonw opened this issue Aug 1, 2021 · 1 comment
Labels

Comments

@simonw
Copy link
Owner

simonw commented Aug 1, 2021

Example: https://latest.datasette.io/fixtures/neighborhood_search?text=cork&_hide_sql=1

Submitting that form again results in this:

https://latest.datasette.io/fixtures/neighborhood_search?sql=%0D%0Aselect+neighborhood%2C+facet_cities.name%2C+state%0D%0Afrom+facetable%0D%0A++++join+facet_cities%0D%0A++++++++on+facetable.city_id+%3D+facet_cities.id%0D%0Awhere+neighborhood+like+%27%25%27+%7C%7C+%3Atext+%7C%7C+%27%25%27%0D%0Aorder+by+neighborhood%3B%0D%0A&_hide_sql=1&text=cork

Because the HTML on https://latest.datasette.io/fixtures/neighborhood_search?text=cork&_hide_sql=1 includes this:

    <h3>Custom SQL query returning 1 row <span class="show-hide-sql">(<a href="/fixtures/neighborhood_search?text=cork">show</a>)</span></h3>
    
    
        <input type="hidden" name="sql" value="
select neighborhood, facet_cities.name, state
from facetable
    join facet_cities
        on facetable.city_id = facet_cities.id
where neighborhood like &#39;%&#39; || :text || &#39;%&#39;
order by neighborhood;
">
        <input type="hidden" name="_hide_sql" value="1">
@simonw simonw added the bug label Aug 1, 2021
@simonw simonw closed this as completed in 4adca0d Aug 1, 2021
@simonw
Copy link
Owner Author

simonw commented Aug 1, 2021

Confirmed: https://latest.datasette.io/fixtures/neighborhood_search?text=cork&_hide_sql=1 no longer exhibits the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant