Skip to content

Commit

Permalink
Merge pull request #9311 from dhalbert/web-workflow-use-abs-path
Browse files Browse the repository at this point in the history
Web workflow: use absolute paths to avoid paths being adjusted by current directory
  • Loading branch information
tannewt authored Jun 6, 2024
2 parents d86e072 + 6ec5d3f commit 76cc0a1
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 76cc0a1

Please sign in to comment.