Skip to content

Commit 76cc0a1

Browse files
authored
Merge pull request #9311 from dhalbert/web-workflow-use-abs-path
Web workflow: use absolute paths to avoid paths being adjusted by current directory
2 parents d86e072 + 6ec5d3f commit 76cc0a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

supervisor/shared/web_workflow/web_workflow.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,15 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
12611261
_reply_missing(socket, request);
12621262
return false;
12631263
}
1264-
path += strlen(vfs->str);
1264+
// Check if the vfs name is one character long: it must be "/" in that case.
1265+
// If so don't remove the mount point name. We must use an absolute path
1266+
// because otherwise the path will be adjusted by os.getcwd() when it's looked up.
1267+
if (strlen(vfs->str) != 1) {
1268+
// Remove the mount point directory name, such as "/sd".
1269+
path += strlen(vfs->str);
1270+
}
12651271
pathlen = strlen(path);
1272+
12661273
}
12671274
FATFS *fs = &fs_mount->fatfs;
12681275
if (directory) {

0 commit comments

Comments
 (0)