Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web workflow: use absolute paths to avoid paths being adjusted by current directory #9311

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion supervisor/shared/web_workflow/web_workflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,15 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
_reply_missing(socket, request);
return false;
}
path += strlen(vfs->str);
// Check if the vfs name is one character long: it must be "/" in that case.
// If so don't remove the mount point name. We must use an absolute path
// because otherwise the path will be adjusted by os.getcwd() when it's looked up.
if (strlen(vfs->str) != 1) {
// Remove the mount point directory name, such as "/sd".
path += strlen(vfs->str);
}
pathlen = strlen(path);

}
FATFS *fs = &fs_mount->fatfs;
if (directory) {
Expand Down