Consider removing the native media delete relay

Aperta
#860 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, kotlin, swift
Ambito
api, mobile-dev

Direzione di ricerca

Read src/utils/api-fetch.js, MediaUploadServer.kt, and MediaUploadSchemeHandler.swift, along with their tests; first confirm #841 is complete because this issue depends on it. Use #594's media failure simulator to exhaust the post-process retries, then verify orphaned attachments are deleted on Android with same-origin and cross-origin REST APIs and on iOS.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

[Type] Code Quality

What problem does this address?

#594 sends the media upload orphan cleanup (DELETE /wp/v2/media/<id>) through native code: the Android loopback upload server and the iOS upload scheme. It did so because a cross-origin editor couldn't send that request: api-fetch sends DELETE as a POST with X-HTTP-Method-Override, and the CORS preflight rejects that header.

#841 sends cross-origin writes with their real method, which the preflight allows. With that in place the relay may no longer be needed. Both native routes only forward the request; neither does any bookkeeping of its own.

What is your proposed solution?

Consider removing the relay and letting the editor send the deletion directly:

  • nativeMediaDelete in src/utils/api-fetch.js
  • The DELETE /media/<id> route in MediaUploadServer.kt
  • The …/media/<id>/delete route in MediaUploadSchemeHandler.swift. iOS deletions would go through the REST relay, as they already do after stopMediaHandling().
  • Their tests

To verify, use #594's media failure simulator to exhaust the post-process retries. Then check that the orphaned attachment is deleted on an Android site whose REST API is on another origin, on a same-origin Android site, and on iOS.

Depends on #841.

Lingua principale
JavaScript
Stelle
29
Fork
6
Merge medio
2g 1h
PR unite (30g)
76

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wordpress-mobile/GutenbergKit

Tutte le issue di wordpress-mobile/GutenbergKit

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.