Skip to content

Stop the tree splicing a whole page into itself - #77

Merged
sotashimozono merged 1 commit into
mainfrom
tree-opens-the-page
Sep 15, 2026
Merged

sotashimozono merged 1 commit into
mainfrom
tree-opens-the-page

Conversation

@sotashimozono

Copy link
Copy Markdown
Member

souta sent a screenshot: their figure gallery rendered inside the file tree, under three rows of directory names. Two defects, and either alone produces it.

?ls was answered with a document

?ls asks for one level of the tree. A directory holding an index.html is served as that page — and that resolution ran before the query was looked at. Measured against the host in the screenshot:

/Vault/Pinax/?ls                  468 bytes of <ul>
/Vault/Pinax/OpenBoundary/?ls   15511 bytes of <html>, a rendered gallery

And the click was taken by the expander

A site is a directory, so its row carries data-dir="1". The handler called preventDefault, fetched ?ls, and insertAdjacentHTML'd whatever came back. The page never opened — it was pasted into the list.

After

?ls        200   1188 bytes   <ul><li><a class="row dir" href="/Vault/Pinax/OpenBoundary/agent/" ...
page       200  15511 bytes   <title>Pinax gallery

A site row now follows its link; only its twisty looks inside. A directory holding an index is somewhere to read, and clicking it should read it.

Why 228 tests missed it

e2e/tree/ has no directory with an index.html inside it, so the case never arose. Two tests now, and they assert the body rather than the status — both answers are 200 text/html, so a status check would have passed throughout. Neutered check: removing the fix fails asking_for_one_level_of_a_site_is_still_a_level, restoring it passes.

230 tests, 63 e2e checks against a real host, fmt/clippy clean.

souta sent a screenshot: their figure gallery rendered inside the file tree,
under three rows of directory names. Two defects, and either one alone produces
it.

`?ls` asks for one level of the tree. A directory holding an `index.html` is
served *as* that page, and that resolution ran before the query was looked at --
so the question "list this folder" was answered with a document. Measured
against the host in the screenshot:

  /Vault/Pinax/?ls                  468 bytes of <ul>
  /Vault/Pinax/OpenBoundary/?ls   15511 bytes of <html>, a rendered gallery

And the tree's click handler took the row, because a site is a directory and
carries `data-dir="1"`. It called `preventDefault`, fetched, and inserted what
came back. So the page never opened; it was pasted into the list.

Now the query is answered before the index is considered, and a site row follows
its link. Only its twisty looks inside -- a directory holding an index is
somewhere to read, and clicking it should read it.

Neither was caught by 228 tests, because `e2e/tree/` has no directory with an
index.html inside it. Two tests now, and the body is what they assert rather
than the status: both answers are `200 text/html`, so a status check would have
passed the whole time. Removing the fix fails the first and restores it passes.

Signed-off-by: Souta <shimozono-sota631@g.ecc.u-tokyo.ac.jp>
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sotashimozono
sotashimozono merged commit 159e615 into main Sep 15, 2026
20 checks passed
@sotashimozono
sotashimozono deleted the tree-opens-the-page branch September 15, 2026 05:00
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.

1 participant