Skip to content

AO3-4059 Change chapters_controller to 404 if given work id is invalid#5929

Open
Bilka2 wants to merge 3 commits into
otwcode:masterfrom
Bilka2:AO3-4059-chapters-should-404
Open

AO3-4059 Change chapters_controller to 404 if given work id is invalid#5929
Bilka2 wants to merge 3 commits into
otwcode:masterfrom
Bilka2:AO3-4059-chapters-should-404

Conversation

@Bilka2

@Bilka2 Bilka2 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Issue

https://otwarchive.atlassian.net/browse/AO3-4059

Purpose

Changed the chapters controller so it 404s if the work id in the URL is invalid, instead of redirecting to the homepage.

Changed the chapters controller so it 404s if the chapter id in the URL is invalid and no work id is given.

Credit

Bilka

@Bilka2 Bilka2 force-pushed the AO3-4059-chapters-should-404 branch from 6375a46 to 7a4d5a9 Compare July 12, 2026 14:02
@Bilka2

Bilka2 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Note for self, desired behavior, should be covered by tests:

  1. /works/[existing] → goes to chapter or work as appropiate - happy path, used by many tests
  2. /works/[existing]/chapters/[existing] → goes to chapter or work as appropiate - happy path, used by many tests
  3. /works/[existing]/chapters/[nonexisting] → goes to chapter or work as appropiate -
    it "errors and redirects to work if chapter is not found" do
  4. /works/[nonexisting] → 404 -
    context "when work does not exist" do
  5. /works/[nonexisting]/chapters/[existing] → 404 - test added here
  6. /works/[nonexisting]/chapters/[nonexisting] → 404 - test added here
  7. /chapters/[existing] → goes to chapter or work as appropiate - test added here
  8. /chapters/[nonexisting] → 404 - test added here

@Bilka2 Bilka2 marked this pull request as draft July 13, 2026 08:14
@Bilka2 Bilka2 marked this pull request as ready for review July 14, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant