I have some fastapi application where I'm mounting a static folder called "files" which works/worked fine until version fastapi 0.108.0, and starlette 0.32.0.
I changed using the absolute path now and see if it makes any difference but it does not.
from fastapi.staticfiles import StaticFiles
# Mount the directory containing static files
static_files_directory = "files"
# Get the absolute path of the directory
absolute_path = os.path.abspath(static_files_directory)
app.mount("/files", StaticFiles(directory=absolute_path), name="files")`
In my application I m showing a profile picture e.g. on localhost http://localhost:8000/files/employees/someemployee.jpeg and server https://test.com/myapp/files/employees/someemployee.jpeg, which again works fine wiht fastapi 108 and starlette 032.
But asap I upgrade it only works on localhost and on the server it says not found.
I was trying to find this process and it seems like this is called.
[pid 1111111] stat("/folder/subfolder/appuser/dev/myapp/app/files/files/employees/someemployee.jpeg", 0x00000000000) = -1 ENOENT (No such file or directory)
I don't know where the second "files" is suddenly coming from. I create the image url like APP_URL + LINK_TO_PIC, e.g. image_url = APP_URL + '/files/employees/someemployee.jpeg'.
Removing the "files" from the second url won't fix the issue.