Commit 149bf6e
fix: rename cached media files to include extension when missing (#22753)
Path resolution can drop the file extension when the source filename
contains spaces (e.g. a Samsung screenshot named "screenshot_one ui
home123.jpg" resolves to a cached path ending in "screenshot_one ui
home123."). The existing code already derives the extension from the
MIME type and appends it to the filename, but the on-disk file path was
left unchanged. This caused downstream upload logic (wordpress-rs /
reqwest) to fail MIME type detection from the path, resulting in "not
allowed to upload this file type" errors.
Rename the cached file on disk to include the correct extension so that
the file path stored in the MediaModel is consistent with the filename.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f21fd62 commit 149bf6e
1 file changed
Lines changed: 20 additions & 0 deletions
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
147 | 167 | | |
148 | 168 | | |
149 | 169 | | |
| |||
0 commit comments