🐛 `QUOTA` support is broken for types other than `STORAGE`

Offen
#622 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
30/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
ruby
Bereich
api, networking

Rechercherichtung

Beginne mit dem Quota-Response-Parser und den Einstiegspunkten Net::IMAP #getquota, #getquotaroot und #setquota und verwende RFC2087 und RFC9208 als Protokollreferenzen. Als abgeschlossen gilt die Aufgabe, wenn mehrere Ressourcentypen ohne Absturz geparst werden, QuotaResponse und abwärtskompatibles Verhalten über die Konfiguration unterstützt werden und das Setzen von Quotas die angeforderten Ressourcentypen akzeptiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Support for the QUOTA extension is broken in several ways: it assumes STORAGE is the only possible quota resource type (which was not true, even for RFC2087) and the response parser will crash the connection if multiple resource types are returned. Fixing this is backward incompatible, so it will need to be hidden behind new config attribute.

Response Parser

Currently, the response parser for quota-response only allows zero or one quota-resource. It implicitly assumes that resource type is STORAGE, so it doesn't store the resource type. And it crashes for more than one resource type.

  • QUOTA response should be parsed consistently with RFC2087 and RFC9208, into a new QuotaResponse type.
Response Data

MailboxQuota must be deprecated: the #mailbox attribute is misleadingly named (it should be #quota_root), the class is misleadingly named (again: it provides information about a "quota root", which does not have a 1-to-1 relationship with mailbox), and it can only list usage and limit for a single resource type

  • QuotaResponse = Data.define(:quota_root, :resources)
    • #to_deprecated_mailbox_quota for backwards compatibility
  • QuotaResponse::Resource = Data.define(:name, :usage, :limit)
Net::IMAP command methods
  • #getquota: Use use_deprecated_mailbox_quota config:
    • when :silent, return only the STORAGE resource (nil if no STORAGE resource)
    • when true, same as :silent but issue a warning for non STORAGE resource types
    • when false, return QuotaResponse rather than MailboxQuota
  • #getquotaroot: Use use_deprecated_mailbox_quota config (same as #getquota)
  • #setquota: support any number of any resource types via *rest args
Additional

Separately from this bug, there are some other QUOTA related issues (TODO: move these to separate issues/PRs):

  • RFC9208 support
    • new capabilities: QUOTA=RES-* and QUOTASET
      • document at class level, and on all three quota methods
    • QuotaResponse: Add accessors "attributes" for every type in the IANA quota resource type registry:
      • def storage = resources.find { "STORAGE".casecmp?(it.name) }
      • def message = resources.find { "MESSAGE".casecmp?(it.name) }
      • def mailbox = resources.find { "MAILBOX".casecmp?(it.name) }
      • def annotation_storage = resources.find { "ANNOTATION-STORAGE".casecmp?(it.name) }
    • new response code: OVERQUOTA
      • document on ResponseCode class
      • add (trivial) support in response parser
    • #setquota:
      • support IANA-registered resource types via keyword args
  • #getquotaroot:
    • Rather than return an array of mixed MailboxQuotaRoot and QuotaResponse objects, return a single hash-like object that combines them.
      • Config#getquotaroot_returns_quotaroot_data
    • Config#setquota_returns_quota_responses => return matching untagged QUOTA responses
Vorherrschende Sprache
Ruby
Sterne
121
Forks
47
Ø Merge
19 Std. 25 Min.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ruby/net-imap

Alle Issues in ruby/net-imap

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.