oficina / base Public

Answer Fable's code review and Luna's copy review (Review 13)

Human

Prompt

Fable approved 0e693a4 with 3 should-fix and 13 nits: announce a send refused for its files, put an idle timer on the download relay, test cross-site delete, another member's upload and hostile file names, take the cheap nits; apply Luna's copy review to Review 13 with typographic apostrophes.

From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.

Summary

S1: a send refused for its files is announced in the chips' words. S2: a file read from Equipo that brings no byte for 30 s (ReadIdle) is given up, the timer reset on every read. S3: tests for a cross-site Remove, deleting or discarding another member's upload, and hostile and empty file names in Base's Content-Disposition. Nits: an upload of unknown length is 411 (N1); the send's message and the upload's answer go through Clean (N3); the fake answers a replayed key before checking the runner, as Equipo does (N4); one id twice is Base's own 422 (N5); the paste rule splits on a lone CR too (N7); thumbnails load lazily (N8). Copy: Luna's five changes and typographic apostrophes, recorded as reviewed in docs/copy-pending.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev f019e7dc0196a7efd6ee69ad685a849d4fbf1143 parent 7d66a69
11 files changed, +191 −65
  • docs/copy-pending.md +26 −24
  • internal/browsertest/attach_test.go +19 −11
  • internal/equipo/equipotest/chat.go +13 −11
  • internal/equipo/files.go +10 −0
  • internal/look/static/ask-attach.js +4 −1
  • internal/look/static/ask.js +3 −3
  • internal/web/ask.go +3 −3
  • internal/web/ask_files.go +23 −3
  • internal/web/ask_relay.go +4 −1
  • internal/web/templates/partials/chat.html +2 −2
  • internal/webtest/ask_files_test.go +84 −6

CI failed — run details

CI log
=== build ===
CGO_ENABLED=0 go build ./...
=== vet ===
go vet ./...
=== fmt-check ===
=== staticcheck ===
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
=== govulncheck ===
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
No vulnerabilities found.
=== gitleaks ===
4:09PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
4:09PM INF 1 commits scanned.
4:09PM INF scanned ~2711812 bytes (2.71 MB) in 693ms
4:09PM INF no leaks found
=== budget ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 22 directories within budget
=== script-test ===
scripts/prepare-apps_test.sh
ok   releases lookup failure stops before ship
ok   app owned elsewhere stops the script
ok   apps listing failure stops before create
ok   ambiguous release dir is refused
ok   explicit version resolves the ambiguity
ok   releases match is exact, not substring
ok   shipped version is only promoted, existing app not created
ok   fresh account creates, ships, promotes to edge, enables
ok   failing promote stops the script
ok   ship is retried while uploads are rate limited
all passed
hack/fonts_test.sh
fonts_test: ok
=== test ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./...
budget: internal/webtest took 13.534s, over the 10s the default allows

receipt: test step 16.658s against a 60s target (the gate's other steps are not in this figure)
receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed
receipt: slow package 13.534s amadan.net/oficina/base/internal/webtest
receipt: slow package 1.615s amadan.net/oficina/base/internal/issuer
receipt: slow package 993ms amadan.net/oficina/base/internal/operations
receipt: slow package 731ms amadan.net/oficina/base/internal/consumer
receipt: slow package 724ms amadan.net/oficina/base/internal/equipo
receipt: slow test 1.53s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot
receipt: slow test 1.23s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce
receipt: slow test 810ms amadan.net/oficina/base/internal/issuer TestAuthorizeSignsForInstalledApp
receipt: slow test 720ms amadan.net/oficina/base/internal/webtest TestAskUploadStalledBodyFreesItsSlot
receipt: slow test 680ms amadan.net/oficina/base/internal/issuer TestAuthorizeRefusals
rastrillo: budget test: 1 problem(s)
exit status 1
make: *** [Makefile:47: test] Error 1

amadan: step test failed: exit status 2

amadan: job failed at step test — its output is above, not at the tail of this log
diff --git a/docs/copy-pending.md b/docs/copy-pending.md
index 5b0bbca..b917e6d 100644
--- a/docs/copy-pending.md
+++ b/docs/copy-pending.md
@@ -20,6 +20,8 @@ Review 8 (Base never names Equipo in the chat, setup or Settings) approved by Pa
Review 9 (jobs: the pill joins, "Started …" lines, and approved words reused on the setup page and the docked chat) approved by Paul on 2026-11-14, unchanged (copy-review cvaxhn3pwgpxhpssj5cgizqtrq).
+Review 13 (files in Ask) reviewed by Luna on 2026-11-26: five strings changed, every other one kept with typographic apostrophes (’). Below.
+
| File | Context | Text |
|---|---|---|
| internal/web/templates/signin.html | Sign-in page, title and heading | Sign in to {Base name} |
@@ -418,31 +420,31 @@ Review 12 (approved, Paul, 2026-11-17, copy review hwmz4ttgslm5ed3k4lafixgffa):
| partials/chat.html, ask.js | APPROVED (Paul, 2026-11-17): the line under the button, naming what connecting unlocks | Calendar, Docs, Sheets and more |
| ask.js | APPROVED (Paul, 2026-11-17): what the button becomes once Oficina is connected, after a tick icon (proposed as "Connected ✓"; the tick is drawn, not typed) | Connected |
-Review 13 (pending; drafts for Luna's pass, then Paul): files in Ask (spec 2026-11-26-ask-attachments, plan Task 11). The person attaches files to a message with the paperclip, by pasting or by dropping, watches each upload as a chip, and sends; the thread shows a person's files above their words. The paperclip and the chips need scripts, and show only when the person's runner can take files. Words reused from Equipo's approved copy where they fit; Base never names Equipo. Equipo's two new strings for the same feature (chat.activity.read_attachment "Reading your file…", api.attachments_unavailable) are reviewed in Equipo's plan, P6. Sizes are written "12 B", "820 KB", "1.2 MB" (units, not copy).
+Review 13 (reviewed by Luna, 2026-11-26; Luna's verdicts are the review, as Paul ruled on 2026-11-17): files in Ask. Five strings changed; every other one kept, with typographic apostrophes (’) (spec 2026-11-26-ask-attachments, plan Task 11). The person attaches files to a message with the paperclip, by pasting or by dropping, watches each upload as a chip, and sends; the thread shows a person's files above their words. The paperclip and the chips need scripts, and show only when the person's runner can take files. Words reused from Equipo's approved copy where they fit; Base never names Equipo. Equipo's two new strings for the same feature (chat.activity.read_attachment "Reading your file…", api.attachments_unavailable) are reviewed in Equipo's plan, P6. Sizes are written "12 B", "820 KB", "1.2 MB" (units, not copy).
| Id | File | Context | Text |
|---|---|---|---|
-| ask.attach.button | partials/chat.html, ask-attach.js | the paperclip left of Send: its label and tooltip | Attach files |
-| ask.attach.drop | partials/chat.html, ask-attach.js | over the composer while files are dragged onto it | Drop files to attach them |
-| ask.attach.uploading | partials/chat.html, ask-attach.js | a chip's line while its file uploads (also the progress ring's label) | Uploading… |
-| ask.attach.remove | partials/chat.html, ask-attach.js | a chip's Remove button, label and tooltip; {name} is the file's name | Remove {name} |
-| ask.attach.failed | partials/chat.html, ask-attach.js | a chip whose upload didn't take (network, or anything unexpected) | Couldn't upload. Try again. |
-| ask.attach.too_many | partials/chat.html, ask-attach.js | the chip of a sixth file, never uploaded | At most 5 files in one message. |
-| ask.attach.pdf | partials/chat.html, ask-attach.js | a PDF's chip once uploaded; it still sends (spec D4; goes in slice 3) | Ask can't read PDFs yet. |
-| ask.attach.unavailable | partials/chat.html, ask-attach.js | every chip of a send refused because the runner can't take files; the paperclip goes, the words stay | Files can't be read right now. Remove them to send your message. |
-| ask.attach.stale | partials/chat.html, ask-attach.js | a chip whose upload had gone when the message was sent (24 hours unsent, or sent elsewhere) | This file has expired. Attach it again. |
-| ask.attach.too_large | partials/chat.html, ask-attach.js | a chip refused for size (checked before upload, and Equipo's attachment_too_large) | That file is over 10 MB. |
-| ask.attach.type | partials/chat.html, ask-attach.js | a chip refused for its type (Equipo's attachment_type) | Ask takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON and PDF files. |
-| ask.attach.heic | partials/chat.html, ask-attach.js | a HEIC photo's chip (checked before upload, and Equipo's attachment_heic) | HEIC photos can't be read yet. Share it as a JPEG and try again. |
-| ask.attach.pixels | partials/chat.html, ask-attach.js | an image refused for its size in pixels (Equipo's attachment_pixels) | That image is too large: at most 12,000 pixels on a side and 40 megapixels. |
-| ask.attach.limit | partials/chat.html, ask-attach.js | Equipo's attachment_limit: 20 uploads wait unsent | Too many files are waiting to send. Send or remove some first. |
-| ask.attach.busy | partials/chat.html, ask-attach.js | every upload slot stayed busy, after five tries | Too many uploads at once. Try again in a moment. |
-| ask.attach.attached | partials/chat.html, ask-attach.js | screen readers, when an upload finishes; {name} is the file's name | {name} attached |
-| ask.attach.not_attached | partials/chat.html, ask-attach.js | screen readers, when a file is refused; {reason} is the chip's line | {name} not attached: {reason} |
-| ask.files.label | partials/chat.html, ask-attach.js | screen readers: the row of a person's files in the thread, and the chips | Attached files |
-| ask.files.pill | partials/chat.html, ask-attach.js | screen readers: a file's pill in the thread, a download; {size} as above | {name}, {size}. Download |
+| ask.attach.button | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): the paperclip left of Send: its label and tooltip | Attach files |
+| ask.attach.drop | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): over the composer while files are dragged onto it | Drop files to attach them |
+| ask.attach.uploading | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): a chip's line while its file uploads (also the progress ring's label) | Uploading… |
+| ask.attach.remove | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): a chip's Remove button, label and tooltip; {name} is the file's name | Remove {name} |
+| ask.attach.failed | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): a chip whose upload didn't take (network, or anything unexpected) | Couldn’t upload. Try again. |
+| ask.attach.too_many | partials/chat.html, ask-attach.js | CHANGED (Luna, 2026-11-26): the chip of a sixth file, never uploaded | ~~At most 5 files in one message.~~ → You can attach up to 5 files to a message. |
+| ask.attach.pdf | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): a PDF's chip once uploaded; it still sends (spec D4; goes in slice 3) | Ask can’t read PDFs yet. |
+| ask.attach.unavailable | partials/chat.html, ask-attach.js | CHANGED (Luna, 2026-11-26): every chip of a send refused because the runner can't take files; the paperclip goes, the words stay | ~~Files can't be read right now. Remove them to send your message.~~ → Files can’t be read right now. Remove them to send your message without them. |
+| ask.attach.stale | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): a chip whose upload had gone when the message was sent (24 hours unsent, or sent elsewhere) | This file has expired. Attach it again. |
+| ask.attach.too_large | partials/chat.html, ask-attach.js | CHANGED (Luna, 2026-11-26): a chip refused for size (checked before upload, and Equipo's attachment_too_large) | ~~That file is over 10 MB.~~ → This file is over the 10 MB limit. |
+| ask.attach.type | partials/chat.html, ask-attach.js | CHANGED (Luna, 2026-11-26): a chip refused for its type (Equipo's attachment_type) | ~~Ask takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON and PDF files.~~ → Attach images (PNG, JPEG, WebP or GIF) or text, Markdown, CSV, JSON or PDF files. |
+| ask.attach.heic | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): a HEIC photo's chip (checked before upload, and Equipo's attachment_heic) | HEIC photos can’t be read yet. Share it as a JPEG and try again. |
+| ask.attach.pixels | partials/chat.html, ask-attach.js | CHANGED (Luna, 2026-11-26): an image refused for its size in pixels (Equipo's attachment_pixels) | ~~That image is too large: at most 12,000 pixels on a side and 40 megapixels.~~ → This image is too large. Use one no larger than 12,000 pixels on a side and 40 megapixels in all. |
+| ask.attach.limit | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): Equipo's attachment_limit: 20 uploads wait unsent | Too many files are waiting to send. Send or remove some first. |
+| ask.attach.busy | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): every upload slot stayed busy, after five tries | Too many uploads at once. Try again in a moment. |
+| ask.attach.attached | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): screen readers, when an upload finishes; {name} is the file's name | {name} attached |
+| ask.attach.not_attached | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): screen readers, when a file is refused; {reason} is the chip's line | {name} not attached: {reason} |
+| ask.files.label | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): screen readers: the row of a person's files in the thread, and the chips | Attached files |
+| ask.files.pill | partials/chat.html, ask-attach.js | REVIEWED (Luna, 2026-11-26): screen readers: a file's pill in the thread, a download; {size} as above | {name}, {size}. Download |
| ask.viewer.close | partials/chat.html, ask-attach.js | APPROVED (reused): the viewer's Close | Close |
-| ask.turn.file_missing | ask.go, ask.js | status line: the turn failed because a file didn't reach the runner whole (reason attachment_unavailable) | A file didn't arrive whole. Attach it again. |
-| ask.turn.no_room | ask.go, ask.js | status line: the runner had no room for the files (runner_storage_full) | There's no room left for these files. Try fewer or smaller ones. |
-| ask.turn.runner_too_old | ask.go, ask.js | status line: the turn with files was failed when an older runner connected (runner_too_old) | Files can't be read right now. Send it again without them. |
-| ask.files_line_a11y | native Thread.swift (Localizable.xcstrings) | VoiceOver: the plain line of a person's files' names under their words in the Mac and iPhone apps, until slice 2 draws files; {names} comma-separated | Attached: {names} |
+| ask.turn.file_missing | ask.go, ask.js | REVIEWED (Luna, 2026-11-26): status line: the turn failed because a file didn't reach the runner whole (reason attachment_unavailable) | A file didn’t arrive whole. Attach it again. |
+| ask.turn.no_room | ask.go, ask.js | REVIEWED (Luna, 2026-11-26): status line: the runner had no room for the files (runner_storage_full) | There’s no room left for these files. Try fewer or smaller ones. |
+| ask.turn.runner_too_old | ask.go, ask.js | REVIEWED (Luna, 2026-11-26): status line: the turn with files was failed when an older runner connected (runner_too_old) | Files can’t be read right now. Send it again without them. |
+| ask.files_line_a11y | native Thread.swift (Localizable.xcstrings) | REVIEWED (Luna, 2026-11-26): VoiceOver: the plain line of a person's files' names under their words in the Mac and iPhone apps, until slice 2 draws files; {names} comma-separated | Attached: {names} |
diff --git a/internal/browsertest/attach_test.go b/internal/browsertest/attach_test.go
index c3b378f..3f32260 100644
--- a/internal/browsertest/attach_test.go
+++ b/internal/browsertest/attach_test.go
@@ -179,7 +179,7 @@ func TestAskAttachPicker(t *testing.T) {
pick(t, rig, paths["shot.png"], paths["note.md"], paths["brief.pdf"])
c := waitChips(t, rig, "done", allDone(3))
if c[0].Name != "shot.png" || !strings.HasPrefix(c[0].Thumb, "/ask/attachments/at_") || !strings.HasSuffix(c[0].Thumb, "/preview") ||
- c[2].Meta != "Ask can't read PDFs yet." || c[1].Thumb != "" {
+ c[2].Meta != "Ask can’t read PDFs yet." || c[1].Thumb != "" {
t.Fatalf("chips: %+v", c)
}
waitFor(t, "an upload announced", func() bool {
@@ -204,7 +204,7 @@ func TestAskAttachPicker(t *testing.T) {
row := `#ask-panel .thread li.msg.person[data-id='` + sentIn + `'] .files`
drive(t, rig, chromedp.WaitVisible(chromedp.CSS(row+` a.thumb img`)))
got := harness.Evaluate[string](rig, `document.querySelector("`+row+`").outerHTML`)
- for _, want := range []string{`<a class="thumb" href="/ask/attachments/` + ids[0] + `" data-attachment="` + ids[0] + `"><img src="/ask/attachments/` + ids[0] + `/preview" alt="shot.png" width="64" height="48"></a>`,
+ for _, want := range []string{`<a class="thumb" href="/ask/attachments/` + ids[0] + `" data-attachment="` + ids[0] + `"><img loading="lazy" src="/ask/attachments/` + ids[0] + `/preview" alt="shot.png" width="64" height="48"></a>`,
`<a class="file" href="/ask/attachments/` + ids[1] + `" download="" aria-label="note.md, 19 B. Download">`, `<span class="file-name">brief.pdf</span>`} {
if !strings.Contains(got, want) {
t.Errorf("thread row lacks %s:\n%s", want, got)
@@ -520,8 +520,8 @@ func TestAskAttachRefusals(t *testing.T) {
c := waitChips(t, rig, "settled", func(c []chip) bool {
return len(c) == 3 && c[0].State == "refused" && c[1].State == "refused" && c[2].State == "refused"
})
- if c[0].Meta != "That file is over 10 MB." || c[1].Meta != "HEIC photos can't be read yet. Share it as a JPEG and try again." ||
- c[2].Meta != "Ask takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON and PDF files." {
+ if c[0].Meta != "This file is over the 10 MB limit." || c[1].Meta != "HEIC photos can’t be read yet. Share it as a JPEG and try again." ||
+ c[2].Meta != "Attach images (PNG, JPEG, WebP or GIF) or text, Markdown, CSV, JSON or PDF files." {
t.Fatalf("refusals: %+v", c)
}
if n := len(f.Calls("/api/v1/attachments")); n != 2 {
@@ -529,14 +529,14 @@ func TestAskAttachRefusals(t *testing.T) {
}
waitFor(t, "a refusal announced", func() bool {
return harness.Evaluate[string](rig, `document.querySelector("#ask-panel form.composer [aria-live]").textContent`) ==
- "data.json not attached: Ask takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON and PDF files."
+ "data.json not attached: Attach images (PNG, JPEG, WebP or GIF) or text, Markdown, CSV, JSON or PDF files."
})
rig.Screen("#ask-panel", "refused files")
viewportShot(t, rig, "attach-refused")
clearChips(t, rig)
pick(t, rig, paths["n1.txt"], paths["n2.txt"], paths["n3.txt"], paths["n4.txt"], paths["n5.txt"], paths["n6.txt"])
c = waitChips(t, rig, "settled", func(c []chip) bool { return len(c) == 6 && c[4].State == "done" })
- if c[5].State != "refused" || c[5].Meta != "At most 5 files in one message." {
+ if c[5].State != "refused" || c[5].Meta != "You can attach up to 5 files to a message." {
t.Fatalf("sixth: %+v", c[5])
}
}
@@ -555,9 +555,14 @@ func TestAskAttachSendRefused(t *testing.T) {
f.FilesReady(false)
drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-panel textarea`), "Read this"), chromedp.Click(chromedp.CSS(`#ask-panel button.send`)))
c := waitChips(t, rig, "unavailable", func(c []chip) bool { return len(c) == 1 && c[0].State == "unavailable" })
- if c[0].Meta != "Files can't be read right now. Remove them to send your message." {
+ if c[0].Meta != "Files can’t be read right now. Remove them to send your message without them." {
t.Fatalf("chip: %+v", c)
}
+ // Said to a screen reader too (Fable S1).
+ waitFor(t, "the refusal announced", func() bool {
+ return harness.Evaluate[string](rig, `document.querySelector("#ask-panel form.composer [aria-live]").textContent`) ==
+ "Files can’t be read right now. Remove them to send your message without them."
+ })
if harness.Evaluate[bool](rig, `document.querySelector("#ask-panel .actions .attach").checkVisibility()`) ||
harness.Evaluate[string](rig, `document.querySelector("#ask-panel").dataset.state`) != "ready" ||
harness.Evaluate[bool](rig, `document.querySelector("#ask-panel [data-when=oldrunner]").checkVisibility()`) ||
@@ -583,6 +588,9 @@ func TestAskAttachSendRefused(t *testing.T) {
if c[0].Meta != "This file has expired. Attach it again." || harness.Evaluate[string](rig, `document.querySelector("#ask-panel .ask-status").textContent`) != "" {
t.Fatalf("stale: %+v", c)
}
+ waitFor(t, "the expiry announced", func() bool {
+ return harness.Evaluate[string](rig, `document.querySelector("#ask-panel form.composer [aria-live]").textContent`) == "This file has expired. Attach it again."
+ })
clearChips(t, rig)
// A send that never arrives keeps its chips.
@@ -682,9 +690,9 @@ func TestAskAttachTurnFailures(t *testing.T) {
f.Hold = true
status := `document.querySelector("#ask-panel .ask-status").textContent`
for _, tc := range []struct{ reason, want string }{
- {"attachment_unavailable", "A file didn't arrive whole. Attach it again."},
- {"runner_storage_full", "There's no room left for these files. Try fewer or smaller ones."},
- {"runner_too_old", "Files can't be read right now. Send it again without them."},
+ {"attachment_unavailable", "A file didn’t arrive whole. Attach it again."},
+ {"runner_storage_full", "There’s no room left for these files. Try fewer or smaller ones."},
+ {"runner_too_old", "Files can’t be read right now. Send it again without them."},
{"model_error", "That didn't get an answer. Try again."},
} {
drive(t, rig, chromedp.SendKeys(chromedp.CSS(`#ask-panel textarea`), "about "+tc.reason), chromedp.Click(chromedp.CSS(`#ask-panel button.send`)),
@@ -710,7 +718,7 @@ func TestAskAttachTurnFailures(t *testing.T) {
waitFor(t, "the turn running", func() bool { return f.Turn(id) == "running" })
f.FailTurnFor(id, "attachment_unavailable")
openPanel(t, rig)
- if got := harness.Evaluate[string](rig, status); got != "A file didn't arrive whole. Attach it again." {
+ if got := harness.Evaluate[string](rig, status); got != "A file didn’t arrive whole. Attach it again." {
t.Errorf("read afresh after a file's failure: %q", got)
}
}
diff --git a/internal/equipo/equipotest/chat.go b/internal/equipo/equipotest/chat.go
index 3463eb4..9169a5c 100644
--- a/internal/equipo/equipotest/chat.go
+++ b/internal/equipo/equipotest/chat.go
@@ -500,17 +500,8 @@ func (f *Fake) send(w http.ResponseWriter, r *http.Request, owner string) {
return
}
f.cmu.Lock()
- if f.runner != "" {
- code := f.runner
- f.cmu.Unlock()
- writeError(w, r, 409, code)
- return
- }
- if len(in.Attachments) > 0 && !f.canAttach() {
- f.cmu.Unlock()
- writeError(w, r, 409, "attachments_unavailable")
- return
- }
+ // A replayed key answers first, as Equipo's LaneStore.Send does; the
+ // runner is checked only for a new message.
if id, ok := f.sent[in.IdempotencyKey]; ok {
for _, m := range f.messages {
if m.ID != id {
@@ -525,6 +516,17 @@ func (f *Fake) send(w http.ResponseWriter, r *http.Request, owner string) {
f.cmu.Unlock()
return
}
+ if f.runner != "" {
+ code := f.runner
+ f.cmu.Unlock()
+ writeError(w, r, 409, code)
+ return
+ }
+ if len(in.Attachments) > 0 && !f.canAttach() {
+ f.cmu.Unlock()
+ writeError(w, r, 409, "attachments_unavailable")
+ return
+ }
if !f.checkFiles(owner, in.Attachments) {
f.cmu.Unlock()
writeError(w, r, 422, "invalid_input")
diff --git a/internal/equipo/files.go b/internal/equipo/files.go
index ca73b8c..634cb7f 100644
--- a/internal/equipo/files.go
+++ b/internal/equipo/files.go
@@ -66,6 +66,16 @@ func (m Message) Clean() Message {
return m
}
+// CleanAttachment is one attachment as Clean passes it on (an id Base
+// would not call Equipo with comes back empty).
+func CleanAttachment(a Attachment) Attachment {
+ m := Message{Attachments: []Attachment{a}}.Clean()
+ if len(m.Attachments) == 0 {
+ return Attachment{}
+ }
+ return m.Attachments[0]
+}
+
// The kinds of attachment.
const (
AttachmentImage = "image"
diff --git a/internal/look/static/ask-attach.js b/internal/look/static/ask-attach.js
index a0a0d3d..a52bce9 100644
--- a/internal/look/static/ask-attach.js
+++ b/internal/look/static/ask-attach.js
@@ -71,6 +71,7 @@ export function filesRow(list, words) {
link.href = href(a.id);
link.dataset.attachment = a.id;
const img = document.createElement("img");
+ img.loading = "lazy";
img.src = href(a.id, true);
img.alt = a.name;
if (a.width && a.height) {
@@ -428,6 +429,8 @@ export function attach(root, hooks) {
if (why === "unavailable") show(it, "unavailable", words.unavailable);
else show(it, "stale", words.stale);
}
+ // Said once, as the chips say it (Fable S1).
+ announce(why === "unavailable" ? words.unavailable : words.stale);
if (why === "unavailable") enable(false);
}
@@ -451,7 +454,7 @@ export function attach(root, hooks) {
return names.has(last);
};
const plain = d.getData("text/plain");
- if (plain && plain.split(/\r?\n/).map((l) => l.trim()).some((l) => l && !own(l))) return false;
+ if (plain && plain.split(/\r\n?|\n/).map((l) => l.trim()).some((l) => l && !own(l))) return false;
e.preventDefault();
add(files);
return true;
diff --git a/internal/look/static/ask.js b/internal/look/static/ask.js
index 73879b8..7863189 100644
--- a/internal/look/static/ask.js
+++ b/internal/look/static/ask.js
@@ -1468,9 +1468,9 @@ function start(root) {
const ended = (s) => s === "replied" || s === "failed" || s === "cancelled";
const failedFiles = {
- attachment_unavailable: "A file didn't arrive whole. Attach it again.",
- runner_storage_full: "There's no room left for these files. Try fewer or smaller ones.",
- runner_too_old: "Files can't be read right now. Send it again without them.",
+ attachment_unavailable: "A file didn’t arrive whole. Attach it again.",
+ runner_storage_full: "There’s no room left for these files. Try fewer or smaller ones.",
+ runner_too_old: "Files can’t be read right now. Send it again without them.",
};
// The field's end holds Stop while a turn runs, else Send once something
diff --git a/internal/web/ask.go b/internal/web/ask.go
index da16f2c..d8070c8 100644
--- a/internal/web/ask.go
+++ b/internal/web/ask.go
@@ -430,9 +430,9 @@ func turnStatus(t *equipo.Turn) string {
// (failedFiles). Any other failure keeps "That didn't get an answer. Try
// again.", which only the panel's script says, as it happens.
var failedFiles = map[string]string{
- "attachment_unavailable": "A file didn't arrive whole. Attach it again.",
- "runner_storage_full": "There's no room left for these files. Try fewer or smaller ones.",
- "runner_too_old": "Files can't be read right now. Send it again without them.",
+ "attachment_unavailable": "A file didn’t arrive whole. Attach it again.",
+ "runner_storage_full": "There’s no room left for these files. Try fewer or smaller ones.",
+ "runner_too_old": "Files can’t be read right now. Send it again without them.",
}
// fill puts a snapshot in the view: the messages, the jobs in the
diff --git a/internal/web/ask_files.go b/internal/web/ask_files.go
index 0b38514..1d959a8 100644
--- a/internal/web/ask_files.go
+++ b/internal/web/ask_files.go
@@ -28,12 +28,14 @@ import (
// the whole process, each taken before its body is read; a request that
// waits SlotWait for one is told to come back; a body is read within
// ReadDeadline; Equipo answers an upload, or a read's headers, within
-// Upstream.
+// Upstream. A file read from Equipo that brings no byte for ReadIdle
+// (30 s when zero) is given up.
type UploadBounds struct {
Slots int
SlotWait time.Duration
ReadDeadline time.Duration
Upstream time.Duration
+ ReadIdle time.Duration
}
var uploadBounds = UploadBounds{Slots: 4, SlotWait: 10 * time.Second, ReadDeadline: 60 * time.Second, Upstream: 60 * time.Second}
@@ -132,6 +134,12 @@ func (a *app) askUpload(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusRequestEntityTooLarge, map[string]string{"code": "attachment_too_large"})
return
}
+ // A body of unknown length would grow its buffer by doubling; a
+ // browser always sends a File's length.
+ if r.ContentLength < 0 {
+ writeJSON(w, http.StatusLengthRequired, map[string]string{"code": "length_required"})
+ return
+ }
c, ok := a.askState(w, r)
if !ok {
return
@@ -197,7 +205,7 @@ func (a *app) askUpload(w http.ResponseWriter, r *http.Request) {
var e *equipo.Error
switch {
case err == nil:
- writeJSON(w, http.StatusCreated, at)
+ writeJSON(w, http.StatusCreated, equipo.CleanAttachment(at))
case errors.Is(err, equipo.ErrUnauthenticated):
a.askLost(r.Context(), c.me, c.device)
writeJSON(w, http.StatusConflict, map[string]string{"state": askReconnect})
@@ -302,7 +310,18 @@ func (a *app) askAttachment(preview bool) http.HandlerFunc {
http.NotFound(w, r)
return
}
- res, err := a.ask.client.OpenAttachment(r.Context(), sec.Token, id, preview)
+ // A read that brings nothing for ReadIdle is given up (the timer is
+ // reset by every read), so a stalled Equipo never holds a browser's
+ // connection.
+ ctx, cancel := context.WithCancel(r.Context())
+ defer cancel()
+ idle := a.ask.uploads.b.ReadIdle
+ if idle <= 0 {
+ idle = 30 * time.Second
+ }
+ quiet := time.AfterFunc(idle, cancel)
+ defer quiet.Stop()
+ res, err := a.ask.client.OpenAttachment(ctx, sec.Token, id, preview)
var e *equipo.Error
switch {
case errors.Is(err, equipo.ErrUnauthenticated):
@@ -370,6 +389,7 @@ func (a *app) askAttachment(preview bool) http.HandlerFunc {
buf := make([]byte, 64<<10)
for {
n, err := res.Body.Read(buf)
+ quiet.Reset(idle)
if n > 0 {
_ = rc.SetWriteDeadline(time.Now().Add(writeWindow))
if _, werr := w.Write(buf[:n]); werr != nil {
diff --git a/internal/web/ask_relay.go b/internal/web/ask_relay.go
index e6aa83b..f2c680c 100644
--- a/internal/web/ask_relay.go
+++ b/internal/web/ask_relay.go
@@ -121,8 +121,10 @@ func (a *app) askSend(w http.ResponseWriter, r *http.Request) {
files := r.PostForm["attachments"]
valid := len(files) <= equipo.MaxFiles && (text != "" || len(files) > 0) && len(text) <= maxAskText &&
utf8.ValidString(text) && !strings.ContainsRune(text, 0)
+ seen := map[string]bool{}
for _, id := range files {
- valid = valid && equipo.ValidAttachmentID(id)
+ valid = valid && equipo.ValidAttachmentID(id) && !seen[id]
+ seen[id] = true
}
if !valid {
if wantsJSON(r) {
@@ -133,6 +135,7 @@ func (a *app) askSend(w http.ResponseWriter, r *http.Request) {
return
}
sent, err := a.ask.client.Send(r.Context(), c.token, text, askKey(r.PostFormValue("key")), files)
+ sent.Message = sent.Message.Clean()
var e *equipo.Error
if len(files) > 0 && err != nil && wantsJSON(r) {
switch {
diff --git a/internal/web/templates/partials/chat.html b/internal/web/templates/partials/chat.html
index 239ac45..265ca91 100644
--- a/internal/web/templates/partials/chat.html
+++ b/internal/web/templates/partials/chat.html
@@ -27,7 +27,7 @@
{{/* A job's card that has ended, in its view: the question and how it ended, nothing to press. The panel's script draws the same (ask.js, addCard). */}}
{{define "ask-jobcard"}}<li class="jv-card" data-card="{{.ID}}" data-revision="{{.Revision}}" data-for="{{.Job}}"><p class="jv-q">{{.Question}}</p><p class="jv-result">{{.Result}}</p></li>{{end}}
{{/* A person's files, above their words: thumbnails first, each a link to the image itself, then a pill per other file (its mark, name and size), a download. Both come from Base's own /ask/attachments, never Equipo's. Without scripts a thumbnail opens the image; the panel's script opens it in a viewer instead, and draws the same row (ask-attach.js, filesRow). */}}
-{{define "ask-files"}}<div class="files" role="group" aria-label="Attached files">{{range .}}{{if eq .Kind "image"}}<a class="thumb" href="/ask/attachments/{{.ID}}" data-attachment="{{.ID}}"><img src="/ask/attachments/{{.ID}}/preview" alt="{{.Name}}"{{if and .Width .Height}} width="{{.Width}}" height="{{.Height}}"{{end}}></a>{{end}}{{end}}{{range .}}{{if ne .Kind "image"}}<a class="file" href="/ask/attachments/{{.ID}}" download aria-label="{{.Name}}, {{fileSize .Size}}. Download">{{template "ask-file-mark"}}<span class="file-name">{{.Name}}</span><span class="file-size">{{fileSize .Size}}</span></a>{{end}}{{end}}</div>{{end}}
+{{define "ask-files"}}<div class="files" role="group" aria-label="Attached files">{{range .}}{{if eq .Kind "image"}}<a class="thumb" href="/ask/attachments/{{.ID}}" data-attachment="{{.ID}}"><img loading="lazy" src="/ask/attachments/{{.ID}}/preview" alt="{{.Name}}"{{if and .Width .Height}} width="{{.Width}}" height="{{.Height}}"{{end}}></a>{{end}}{{end}}{{range .}}{{if ne .Kind "image"}}<a class="file" href="/ask/attachments/{{.ID}}" download aria-label="{{.Name}}, {{fileSize .Size}}. Download">{{template "ask-file-mark"}}<span class="file-name">{{.Name}}</span><span class="file-size">{{fileSize .Size}}</span></a>{{end}}{{end}}</div>{{end}}
{{/* A file's mark: a page with its corner folded. ask-attach.js has the same path (fileMark). */}}
{{define "ask-file-mark"}}<svg class="file-mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M14 3.5H7.5a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2V8zM14 3.5V8h4.5"/></svg>{{end}}
{{define "ask-body"}}<div class="ask-note" data-when="connect"{{if not (.Shows "connect")}} hidden{{end}}>
@@ -62,5 +62,5 @@
<p class="ask-status" role="status">{{.Status}}</p>
</div>
{{/* The composer: Send (an arrow) and, while a turn runs, Stop (a square) sit inside the field's end. Stop posts the cancel form beside it. Without scripts Send always shows; the panel's script hides it while the field is empty, and while a turn runs. Password managers are told it is no login (autocomplete off, and 1Password's, LastPass's and Dashlane's own marks); spell-check and the keyboard are untouched. */}}<form class="cancel" id="ask-cancel" method="post" action="{{with .Turn}}/ask/turns/{{.ID}}/cancel{{else}}/ask{{end}}"><input type="hidden" name="key" value="{{newKey}}"></form>
-{{/* The composer's words for files (copy review 13, pending) are on it as data-w-*, for ask-attach.js, which adds the paperclip, the chips and the viewer only with scripts, and only while the snapshot says can_attach (data-can-attach); data-attach is its module. */}}<form class="composer" method="post" action="/ask/messages" data-attach="{{asset "static/ask-attach.js"}}"{{if .CanAttach}} data-can-attach{{end}} data-w-attach="Attach files" data-w-drop="Drop files to attach them" data-w-uploading="Uploading…" data-w-remove="Remove {name}" data-w-failed="Couldn't upload. Try again." data-w-too-many="At most 5 files in one message." data-w-pdf="Ask can't read PDFs yet." data-w-unavailable="Files can't be read right now. Remove them to send your message." data-w-stale="This file has expired. Attach it again." data-w-too-large="That file is over 10 MB." data-w-type="Ask takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON and PDF files." data-w-heic="HEIC photos can't be read yet. Share it as a JPEG and try again." data-w-pixels="That image is too large: at most 12,000 pixels on a side and 40 megapixels." data-w-limit="Too many files are waiting to send. Send or remove some first." data-w-busy="Too many uploads at once. Try again in a moment." data-w-attached="{name} attached" data-w-not-attached="{name} not attached: {reason}" data-w-files="Attached files" data-w-pill="{name}, {size}. Download" data-w-close="Close"><input type="hidden" name="key" value="{{.Key}}"><label class="sr-only" for="ask-text">Message</label><div class="field"><textarea class="input" id="ask-text" name="text" rows="1" required maxlength="16000" placeholder="Ask Base anything" autocomplete="off" data-1p-ignore data-lpignore="true" data-form-type="other">{{.Text}}</textarea><div class="actions"><button class="send" type="submit" aria-label="Send" title="Send"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M6 11l6-6 6 6"/></svg></button><button class="stop" type="submit" form="ask-cancel" aria-label="Stop" title="Stop"{{if not .Turn}} hidden{{end}}><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="6.5" width="11" height="11" rx="2"/></svg></button></div></div></form>
+{{/* The composer's words for files (copy review 13, pending) are on it as data-w-*, for ask-attach.js, which adds the paperclip, the chips and the viewer only with scripts, and only while the snapshot says can_attach (data-can-attach); data-attach is its module. */}}<form class="composer" method="post" action="/ask/messages" data-attach="{{asset "static/ask-attach.js"}}"{{if .CanAttach}} data-can-attach{{end}} data-w-attach="Attach files" data-w-drop="Drop files to attach them" data-w-uploading="Uploading…" data-w-remove="Remove {name}" data-w-failed="Couldn’t upload. Try again." data-w-too-many="You can attach up to 5 files to a message." data-w-pdf="Ask can’t read PDFs yet." data-w-unavailable="Files can’t be read right now. Remove them to send your message without them." data-w-stale="This file has expired. Attach it again." data-w-too-large="This file is over the 10 MB limit." data-w-type="Attach images (PNG, JPEG, WebP or GIF) or text, Markdown, CSV, JSON or PDF files." data-w-heic="HEIC photos can’t be read yet. Share it as a JPEG and try again." data-w-pixels="This image is too large. Use one no larger than 12,000 pixels on a side and 40 megapixels in all." data-w-limit="Too many files are waiting to send. Send or remove some first." data-w-busy="Too many uploads at once. Try again in a moment." data-w-attached="{name} attached" data-w-not-attached="{name} not attached: {reason}" data-w-files="Attached files" data-w-pill="{name}, {size}. Download" data-w-close="Close"><input type="hidden" name="key" value="{{.Key}}"><label class="sr-only" for="ask-text">Message</label><div class="field"><textarea class="input" id="ask-text" name="text" rows="1" required maxlength="16000" placeholder="Ask Base anything" autocomplete="off" data-1p-ignore data-lpignore="true" data-form-type="other">{{.Text}}</textarea><div class="actions"><button class="send" type="submit" aria-label="Send" title="Send"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M6 11l6-6 6 6"/></svg></button><button class="stop" type="submit" form="ask-cancel" aria-label="Stop" title="Stop"{{if not .Turn}} hidden{{end}}><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="6.5" y="6.5" width="11" height="11" rx="2"/></svg></button></div></div></form>
</div>{{end}}
diff --git a/internal/webtest/ask_files_test.go b/internal/webtest/ask_files_test.go
index da0c743..11deba5 100644
--- a/internal/webtest/ask_files_test.go
+++ b/internal/webtest/ask_files_test.go
@@ -114,10 +114,12 @@ func TestAskUploadTooBig(t *testing.T) {
if r := a.upload("big.txt", "text/plain", big); r.Code != 413 {
t.Fatalf("declared: %d %s", r.Code, r.Body)
}
+ // A body of unknown length is refused before it is read (Fable N1): a
+ // browser always says a File's length.
req := a.uploadReq(context.Background(), "big.txt", "text/plain", io.MultiReader(bytes.NewReader(big)))
req.ContentLength = -1
r := a.do(req)
- if code, _, _ := codeOf(r); r.Code != 413 || code != "attachment_too_large" {
+ if code, _, _ := codeOf(r); r.Code != 411 || code != "length_required" {
t.Fatalf("undeclared: %d %s", r.Code, r.Body)
}
if n := len(f.Calls("/api/v1/attachments")); n != 0 {
@@ -398,7 +400,8 @@ func TestAskAttachmentDownload(t *testing.T) {
// Base never trusts Equipo's type or disposition (Fable B4): HTML said to
// be inline goes as a download, an SVG as an octet stream, and neither
-// has a preview.
+// has a preview. A hostile name can't add a parameter or a header, and a
+// missing one reads "file" (Fable S3).
func TestAskAttachmentHostileUpstream(t *testing.T) {
a, f := newAskApp(t)
a.connectEquipo(f)
@@ -414,6 +417,46 @@ func TestAskAttachmentHostileUpstream(t *testing.T) {
t.Errorf("%s preview: %d", typ, r.Code)
}
}
+ f.ServeHostile("", "")
+ for name, want := range map[string]string{
+ "a\"; filename=evil.html; x=\"\r\nSet-Cookie: a=b.txt": "",
+ "résumé; final.txt": "résumé; final.txt",
+ "": "file",
+ } {
+ id := uploaded(t, a.upload(name, "text/plain", []byte("note")))
+ r := a.get("/ask/attachments/" + id)
+ cd := r.Header.Get("Content-Disposition")
+ _, params, err := mime.ParseMediaType(cd)
+ if r.Code != 200 || err != nil || len(params) != 1 || r.Header.Get("Set-Cookie") != "" || strings.ContainsAny(cd, "\r\n") {
+ t.Errorf("%q: %d %q %v %v", name, r.Code, cd, params, err)
+ }
+ if want != "" && params["filename"] != want {
+ t.Errorf("%q: name %q, want %q", name, params["filename"], want)
+ }
+ if want == "" && strings.Contains(params["filename"], "\n") {
+ t.Errorf("%q: name %q", name, params["filename"])
+ }
+ }
+}
+
+// A read that stalls mid-body is given up at the idle bound (Fable S2):
+// the browser's connection is let go, and nothing more comes.
+func TestAskAttachmentStalledReadIsDropped(t *testing.T) {
+ bounds(t, web.UploadBounds{Slots: 4, SlotWait: time.Second, ReadDeadline: 5 * time.Second, Upstream: 5 * time.Second, ReadIdle: 150 * time.Millisecond})
+ a, f := newAskApp(t)
+ a.connectEquipo(f)
+ id := uploaded(t, a.upload("big.txt", "text/plain", bytes.Repeat([]byte("x"), 256<<10)))
+ f.ServeSlowly(2 * time.Second) // a pause after each 64 KiB, longer than the bound
+ start := time.Now()
+ res, err := a.client.Get(a.base + "/ask/attachments/" + id)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got, err := io.ReadAll(res.Body)
+ res.Body.Close()
+ if took := time.Since(start); took > 1500*time.Millisecond || len(got) >= 256<<10 {
+ t.Fatalf("read %d bytes in %s (%v)", len(got), took, err)
+ }
}
// A big file streams through as Equipo writes it, never held whole.
@@ -545,6 +588,40 @@ func TestAskRemoveDeletesTheUpload(t *testing.T) {
if r := a.del("nope"); r.Code != 404 {
t.Fatalf("not an id: %d", r.Code)
}
+ // From another site, Remove is refused before Equipo hears of it
+ // (Fable S3).
+ req, _ := http.NewRequest(http.MethodDelete, a.base+"/ask/attachments/"+ids[5], nil)
+ req.Header.Set("Origin", "https://evil.example")
+ req.Header.Set("Accept", "application/json")
+ if r := a.do(req); r.Code != 403 || len(f.Calls("/api/v1/attachments/"+ids[5])) != 0 {
+ t.Fatalf("cross-site remove: %d", r.Code)
+ }
+}
+
+// A member can't delete or discard another member's upload (Fable S3):
+// Base asks Equipo with their own bearer, which answers as if it were
+// gone, so both are 204 and the upload stays.
+func TestAskRemoveNotYours(t *testing.T) {
+ a, f := newAskApp(t)
+ a.connectEquipo(f)
+ if r := a.post("/people", invite("maria@acme.test")); r.Code != 303 {
+ t.Fatalf("invite: %d", r.Code)
+ }
+ maria := a.newBrowser()
+ if r := maria.signIn("maria@acme.test"); r.Code != 303 {
+ t.Fatalf("maria: %d", r.Code)
+ }
+ maria.approveEquipo(f)
+ hers := uploaded(t, maria.upload("hers.txt", "text/plain", []byte("hers")))
+ if r := a.del(hers); r.Code != 204 {
+ t.Fatalf("remove: %d %s", r.Code, r.Body)
+ }
+ if r := a.post("/ask/attachments/discard", url.Values{"id": {hers}}); r.Code != 204 {
+ t.Fatalf("discard: %d", r.Code)
+ }
+ if _, _, _, _, ok := f.Upload(hers); !ok {
+ t.Fatal("another member deleted her upload")
+ }
}
// The page's beacon as it goes deletes what was never sent, as best Base
@@ -637,6 +714,7 @@ func TestAskSendWithFiles(t *testing.T) {
"invalid UTF-8": {"text": {"hi \xff"}, "attachments": {six[0]}},
"words too long": {"text": {strings.Repeat("a", 16<<10+1)}, "attachments": {six[0]}},
"an empty id too": {"text": {"hi"}, "attachments": {""}},
+ "one id twice": {"text": {"hi"}, "attachments": {six[0], six[0]}},
} {
r := a.postJSON("/ask/messages", form)
if _, state, files := codeOf(r); r.Code != 422 || state != "ready" || files != "" {
@@ -774,7 +852,7 @@ func TestAskThreadDrawsFiles(t *testing.T) {
}
page := a.get("/ask")
for _, want := range []string{
- `<div class="files" role="group" aria-label="Attached files"><a class="thumb" href="/ask/attachments/` + shot + `" data-attachment="` + shot + `"><img src="/ask/attachments/` + shot + `/preview" alt="Screen &lt;1&gt;.png" width="64" height="48"></a>`,
+ `<div class="files" role="group" aria-label="Attached files"><a class="thumb" href="/ask/attachments/` + shot + `" data-attachment="` + shot + `"><img loading="lazy" src="/ask/attachments/` + shot + `/preview" alt="Screen &lt;1&gt;.png" width="64" height="48"></a>`,
`<a class="file" href="/ask/attachments/` + csv + `" download aria-label="sales.csv, 1 KB. Download">`,
`<span class="file-name">sales.csv</span><span class="file-size">1 KB</span></a></div>These two</li>`,
`<li class="msg person" data-id="`,
@@ -798,9 +876,9 @@ func TestAskTurnFailedForFiles(t *testing.T) {
a.connectEquipo(f)
f.Hold = true
for reason, want := range map[string]string{
- "attachment_unavailable": "A file didn't arrive whole. Attach it again.",
- "runner_storage_full": "There's no room left for these files. Try fewer or smaller ones.",
- "runner_too_old": "Files can't be read right now. Send it again without them.",
+ "attachment_unavailable": "A file didn’t arrive whole. Attach it again.",
+ "runner_storage_full": "There’s no room left for these files. Try fewer or smaller ones.",
+ "runner_too_old": "Files can’t be read right now. Send it again without them.",
"model_error": "",
} {
r := a.postJSON("/ask/messages", url.Values{"text": {"about " + reason}})