Skip to content

fix(server): accept the routed path in the index view - #545

Closed
Eljees wants to merge 2 commits into
infobyte:masterfrom
Eljees:fix/index-view-kwargs-543
Closed

Eljees wants to merge 2 commits into
infobyte:masterfrom
Eljees:fix/index-view-kwargs-543

Conversation

@Eljees

@Eljees Eljees commented Jul 28, 2026

Copy link
Copy Markdown

Fixes #543

GET / returns HTTP 500 on a fresh install because the view function and its routes disagree:

@app.errorhandler(404)
@app.route('/', defaults={'text': ''})
@app.route('/<path:text>')
def index(ex):

Both routes supply text, and the error handler supplies ex, so Flask always calls index() with a keyword the signature doesn't accept:

TypeError: create_app.<locals>.index() got an unexpected keyword argument 'text'

This is the same one-line change that PR #537 made and that was lost when master was re-synced (see #543 for the archaeology; #541 was closed with a workaround that no longer helps, because master itself is broken).

Reproduced before and after

Minimal Flask app with exactly these decorators, python:3.12 / Flask 3:

master      GET /      -> 500
master      GET /a/b   -> 500
master      raises     -> TypeError: index() got an unexpected keyword argument 'text'
with fix    GET /      -> 200
with fix    GET /a/b   -> 200

ex=None, text=None keeps every existing caller working: the 404 handler still passes the exception, both routes still pass the captured path, and the body of the function is unchanged.

One note from the issue that is worth acting on separately: the fix needs to land on whichever internal branch master is synced from, otherwise it will be dropped again the next time.

AI-assisted (LLM used for drafting); the reproduction above was run and verified by me.

Devops and others added 2 commits July 23, 2026 16:34
Both catch-all routes pass 'text' and the 404 handler passes 'ex', so every request to '/' raised TypeError and returned HTTP 500. Restores the signature from PR infobyte#537.

Signed-off-by: Eljees <3.14hell@gmail.com>
@Eljees

Eljees commented Aug 9, 2026

Copy link
Copy Markdown
Author

Ping on this one and #546 - both have been open since 28 July. One fixes the index view under a routed path, the other execs the compose command instead of always starting the server; independent of each other.

@Eljees

Eljees commented Sep 10, 2026

Copy link
Copy Markdown
Author

Closing this — the change is already on master, so the PR is now a no-op.

faraday/server/app.py on master today reads:

    @app.errorhandler(404)
    @app.route('/', defaults={'text': ''})
    @app.route('/<path:text>')
    def index(ex=None, text=None):

which is exactly what this PR proposed. It arrived with the merge 153937f (2026-09-02): of its two parents, 8a7077c already carried the fixed signature and fdeffcb still had def index(ex), so the merge is what put it on master.

Two things worth separating out, in case they are useful:

  • The fix from PR #537 was lost from master #543 is still open and its last confirmation is from 2026-08-31, a couple of days before that merge. I have left a note there with the same check so it can be re-verified and closed.
  • This branch also carried a large unintended diff — faraday/server/www is a symlink to ../frontend/www, and my checkout replaced it with the built assets it pointed at. That is my mistake and it is the reason the PR went to conflicting; it has nothing to do with the one-line change. Apologies for the noise.

Thanks for the time either way.

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.

The fix from PR #537 was lost from master

1 participant