Skip to content

Clicking 'Run SQL' from extneded query.html page results in URL not found error #2487

@hcarter333

Description

@hcarter333

Version: 1.0a19

I see the following initial query form button, (the point to note here is that we're not in the query.html extension yet.)

Image

on the database's home page
http://192.168.0.203/sam_datasette/rm_toucans_slice

Image

The initial query page's form looks like this

<html>
<body>
<!--StartFragment-->
<form class="sql core" action="/sam_datasette/rm_toucans_slice/-/query" method="get">
--
  | <h3>Custom SQL query</h3>
  | <p><textarea id="sql-editor" name="sql">select * from rm_rnb_history_pres</textarea></p>
  | <p>
  | <button id="sql-format" type="button" hidden>Format SQL</button>
  | <input type="submit" value="Run SQL">
  | </p>
  | </form>

<!--EndFragment-->
</body>
</html>

After running the query, the form looks like

Image

The query page form after the query has been run and landed in an extended query.html looks like this

<form class="sql core" action="/sam_datasette/rm_toucans_slice" method="get">
--
  | <h3>Custom SQL query returning 50 rows
  | <span class="show-hide-sql">(<a href="/sam_datasette/rm_toucans_slice/-/query?sql=++++++select%0D%0A++rowid%2C%0D%0A++id%2C%0D%0A++tx_lng%2C%0D%0A++tx_lat%2C%0D%0A++rx_lng%2C%0D%0A++rx_lat%2C%0D%0A++timestamp%2C%0D%0A++strftime%28%27%25Y%25m%25d%27%2C+timestamp%29+as+date%2C%0D%0A++strftime%28%27%25H%25M%27%2C+timestamp%29+as+time%2C%0D%0A++midpoint_lat%28tx_lat%2C+tx_lng%2C+rx_lat%2C+rx_lng%29+as+ap_lat%2C%0D%0A++midpoint_lng%28tx_lat%2C+tx_lng%2C+rx_lat%2C+rx_lng%29+as+ap_lng%2C++%0D%0A++haversine%28tx_lat%2C+tx_lng%2C+rx_lat%2C+rx_lng%29+as+length%2C%0D%0A++dB%2C%0D%0A++frequency%2C%0D%0A++Spotter%2C%0D%0A++Country%2C%0D%0A++State%2C%0D%0A++County%2C%0D%0A++City%2C%0D%0A++QSL_Sent%2C%0D%0A++QSL_Rx%2C%0D%0A++QSL_link%2C%0D%0A++QSL_rx_link%2C%0D%0A++tx_rst%2C%0D%0A++park%2C%0D%0A++p2p_s2%2C%0D%0A++call%2C%0D%0A++skcc%2C%0D%0A++naqcc%2C%0D%0A++f2m%2C%0D%0A++launchangle%2C%0D%0A++%2722%27+as+elev_tx%0D%0Afrom%0D%0A++rm_rnb_history_pres%0D%0Awhere+%0D%0A++dB+%3E+100%0D%0A++and+timestamp+%3E+%272025-04-26T00%3A25%3A00%27%0D%0A++and+timestamp+%3C+%272025-04-27T01%3A55%3A00%27%0D%0Aorder+by%0D%0A++timestamp%0D%0A&amp;_hide_sql=1">hide</a>)</span>
  | </h3>
  |  
  |  
  |  
  | <p><textarea id="sql-editor" name="sql" style="height: 44em"
  | >      select
  | rowid,
  | id,
  | tx_lng,
  |  

Notice that the form action has changed and no longer contains the breadcrum. When the 'Run SQL' button is clicked again with no other changes, the page isn't found

Image

Also notice that the not found address:
http://192.168.0.203/rm_toucans_slice/-/query?sql=+

no longer contains sam_datasette, while the previous address did:
http://192.168.0.203/sam_datasette/rm_toucans_slice/-/query?sql=+++

sam_datasette being stripped is causing the URL not found error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions