Commit d334eb4
committed
fix: S3 exists() should not match directories for file paths
Previously, exists() would incorrectly add a trailing slash to all paths,
causing file paths to match directories with the same prefix. This led to
exists('/path/to/file.html') returning true when only the directory
'/path/to/file.html/' existed, resulting in NoSuchKey errors when trying
to read the file.
Now, trailing slashes are only added if the original path ends with '/',
ensuring:
- exists('file.html') only returns true if the file exists
- exists('directory/') correctly checks for directory existence
Added test testFileExistsDoesNotMatchDirectoryPrefix() to verify the fix.1 parent 10fe0c0 commit d334eb4
2 files changed
+21
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
640 | | - | |
| 639 | + | |
| 640 | + | |
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
168 | 187 | | |
169 | 188 | | |
170 | 189 | | |
| |||
0 commit comments