Commit 91a87bc
fix: auto-create intermediate directories for nested database paths
The path traversal validation introduced in e58189d canonicalizes the
parent directory to verify containment, but this fails with an IO error
when intermediate directories in a relative path (e.g. "subdir/mydb.db")
do not yet exist. The previous implementation returned the joined path
without requiring the parent to exist.
Call create_dir_all on the parent before canonicalizing so that nested
relative paths work without the caller needing to pre-create
subdirectories.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 10f6f71 commit 91a87bc
1 file changed
Lines changed: 20 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | | - | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
138 | | - | |
139 | | - | |
| 144 | + | |
140 | 145 | | |
141 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
142 | 156 | | |
143 | 157 | | |
144 | 158 | | |
| |||
0 commit comments