Commit 16fd9de
committed
fix replacing asset while copying past data
Attempting to update the existing SponsorshipAssetFile by URL containing
target conference slug would result into 404. Luckily it resulted
into 404, it could overwrite existing data which is unhappy for organizers
if we lack conference_slug in asset files controller.
This patch properly handles 4 differenct scenario that
sponsorships/_form can see:
1. new: sponsorship and asset_file is new, and not submitted yet.
2. copy: sponsorship is new and asset_file belongs to other conference.
Happens when a sponsorship is sourced using past data. Never happens
after #create, as it does s3:CopyObject and inserts new
unclaimed SponsorshipAssetFile.
3. unclaimed: sponsorship is new. asset_file is persisted but unclaimed.
Happens when a sponsorship is not valid on #create.
4. existing: sponsorship and asset_file are both persisted.
> Level: Error Non-Error promise rejection captured with value: Uploader getSession failed: status=404
https://rubykaigi.sentry.io/issues/7053573751/events/5966851ed69e42fd9a976f807d7f2a69/1 parent e042f6e commit 16fd9de
1 file changed
+34
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 202 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
212 | 230 | | |
213 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
214 | 238 | | |
215 | 239 | | |
216 | 240 | | |
| |||
0 commit comments