Commit ce6146d
fix: sanitize filename with path separators in FileSchema.decode (#5533)
* fix: sanitize filename with path separators in FileSchema.decode
Fixes #5532
When users upload files with filenames containing path separators
(e.g., "payslips/red/genuine/uuid.pdf"), the filename was passed
directly to tempfile.NamedTemporaryFile() as a suffix, causing a
FileNotFoundError because the temp file system tried to create
nested directories that don't exist.
This change uses os.path.basename() to extract only the filename
from the path, preventing the error while preserving the file
extension for proper handling.
* ci: auto fixes from pre-commit.ci
For more information, see https://pre-commit.ci
---------
Co-authored-by: Anri Lombard <anri.m.lombard@sprinthive.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 31ccc0b commit ce6146d
File tree
3 files changed
+29
-1
lines changed- src/_bentoml_sdk
- tests/unit/_bentoml_sdk
3 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
158 | 159 | | |
159 | | - | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments