Skip to content

Bug introduced in 4.1.4 related to file_dep #79

@oskarsari

Description

@oskarsari

After updating to version 4.1.4, file uploads in my application are broken. The traceback seems to point to the changes made related to file_dep in the recently merged PR. This is how I initiate my router:

file_upload_router = create_tus_router(
    files_dir=runtime.env.path("temp"),
    upload_complete_dep=get_upload_handler,
    prefix="api/file/upload",
)

And this is the error I get when trying to upload a file:

 /python3.12/site-packages/fastapi/rou │
│ ting.py:212 in run_endpoint_function                                         │
│                                                                              │
│    209 │   assert dependant.call is not None, "dependant.call must be a func │
│    210 │                                                                     │
│    211 │   if is_coroutine:                                                  │
│ ❱  212 │   │   return await dependant.call(**values)                         │
│    213 │   else:                                                             │
│    214 │   │   return await run_in_threadpool(dependant.call, **values)      │
│    215                                                                       │
│                                                                              │
│ /python3.12/site-packages/tuspyserver │
│ /routes/creation.py:92 in extension_creation_route                           │
│                                                                              │
│    89 │   │   if inspect.isawaitable(result):                                │
│    90 │   │   │   await result                                               │
│    91 │   │   uid = None                                                     │
│ ❱  92 │   │   file_result = file_dep(metadata)                               │
│    93 │   │   file_options = deepcopy(options)                               │
│    94 │   │   # if the callback returned a coroutine, await it               │
│    95 │   │   if inspect.isawaitable(file_result):                           │
╰──────────────────────────────────────────────────────────────────────────────╯
TypeError: create_tus_router.<locals>._fallback_file_dep() takes 0 positional
arguments but 1 was given

Unfortunately right now I don't have time to debug this myself, so don't have a fix to suggest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions