The path that starts at a share
A supposedly relative upload path becomes an absolute network-share path on another platform.
What’s going wrong
A cross-platform upload path guard simulates a legacy Windows absolute-path check. It rejects ordinary absolute paths but misses the two-slash network-share form.
Input is an array of path strings. Normalize each with posixpath.normpath. Reject normalized paths containing a backslash, beginning with /, having a colon at index 1, equal to .., or beginning with ../. Otherwise return posixpath.join("uploads", normalized). Print the resulting array of strings or null. Dot and empty paths normalize to `.` and return `uploads/.`. This is a pure string operation; no file is opened. Preserve accepted relative paths.
Expected behavior
Only normalized relative paths can be joined under the upload prefix, independent of the legacy platform check.
Reproduction
["//server/share/file"]
[null]
["photo.png","images/a.png"]
["uploads/photo.png","uploads/images/a.png"]
["a/../b","./a"]
["uploads/b","uploads/a"]
Before you begin
- Path normalization
- Platform differences
- Validation
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.