Skip to content

fix: rename internal drag-drop MIME type to RFC 6838 form#1468

Merged
annejan merged 2 commits into
mainfrom
fix/storemodel-mime-type-rfc
May 13, 2026
Merged

fix: rename internal drag-drop MIME type to RFC 6838 form#1468
annejan merged 2 commits into
mainfrom
fix/storemodel-mime-type-rfc

Conversation

@annejan
Copy link
Copy Markdown
Member

@annejan annejan commented May 13, 2026

Summary

CodeRabbit flagged that the internal drag-drop MIME identifier
`application/vnd+qtpass.dragAndDropInfoPasswordStore` is malformed per RFC 6838:

  • `+` is reserved for structured-syntax suffixes (e.g. `application/atom+xml`)
  • the vendor-tree separator is `.` — the right form is `application/vnd.qtpass.dragAndDropInfoPasswordStore`

Scope

Internal-only identifier — drag/drop happens between QtPass widgets in the same process. No external compatibility concern.

9 occurrences renamed in lockstep:

  • `src/storemodel.cpp`: `mimeTypes()`, `mimeData()`, `canDropMimeData()` ×2, `parseDropData()`
  • `tests/auto/model/tst_storemodel.cpp`: 4 assertions + the `makeMimeData` helper

Also moved `` to live with the C++ stdlib headers above the Qt headers, matching the stdlib-then-Qt-then-project convention.

Test plan

  • `qmake6 -r && make -j4` clean
  • `tests/auto/model/tst_model` — 33/33

Other CodeRabbit nits in tst_util.cpp (re-evaluated, still skipped)

  • `DF9` → `DF_9` rename — only file-scope constant with a number suffix; no other example to be consistent with
  • Hoist `ASSUMED_MAX_KEY_ID_LENGTH` to file scope — used in exactly one test
  • `ScopedUmask` RAII guard — Qt Test doesn't throw on assertion failures

Same rationale as #1467.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the drag-and-drop MIME format so password store items are correctly recognized and transferred, restoring reliable drag-and-drop behavior across the app.
  • Tests

    • Updated automated tests to validate the corrected drag-and-drop format and ensure consistent behavior going forward.

Review Change Stack

The internal MIME identifier QtPass uses for drag-and-drop payloads
was registered as "application/vnd+qtpass.dragAndDropInfoPasswordStore".
The '+' in that form is reserved for structured-syntax suffixes (e.g.
"application/atom+xml") in RFC 6838; the vendor-tree separator is
'.'. Rename to "application/vnd.qtpass.dragAndDropInfoPasswordStore".

Used in exactly 9 places, all inside QtPass:
- src/storemodel.cpp: mimeTypes(), mimeData(), canDropMimeData() x2,
  parseDropData()
- tests/auto/model/tst_storemodel.cpp: 4 assertions + makeMimeData()

Internal-only identifier (drag/drop happens between QtPass widgets in
the same process), so no compatibility break.

Also rearrange the test include block — <memory> now sits with the
C++ stdlib headers above the Qt headers, matching the
stdlib-then-Qt-then-project convention used elsewhere.

Build clean, 33/33 storemodel tests pass.

Other CodeRabbit nits in tst_util.cpp (DF9 underscore, hoist
ASSUMED_MAX_KEY_ID_LENGTH, ScopedUmask RAII) were re-evaluated and
still skipped — same rationale as #1467.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6548c514-f182-4aa9-80ad-f773f79023b6

📥 Commits

Reviewing files that changed from the base of the PR and between 531bd95 and e076211.

📒 Files selected for processing (1)
  • tests/auto/model/tst_storemodel.cpp

📝 Walkthrough

Walkthrough

This PR corrects the MIME type string used for StoreModel drag-and-drop from application/vnd+qtpass.dragAndDropInfoPasswordStore to application/vnd.qtpass.dragAndDropInfoPasswordStore, updating implementation sites and corresponding test expectations.

Changes

MIME Type Format Correction

Layer / File(s) Summary
StoreModel MIME type updates
src/storemodel.cpp
mimeTypes(), mimeData(), canDropMimeData(), and parseDropData() now use application/vnd.qtpass.dragAndDropInfoPasswordStore (dot-notation).
Test updates for MIME type change
tests/auto/model/tst_storemodel.cpp
Test assertions and helpers updated to expect/use application/vnd.qtpass.dragAndDropInfoPasswordStore; includes reordered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • IJHack/QtPass#1196: Both PRs touch StoreModel drag-and-drop MIME handling in tst_storemodel.cpp and QMimeData payloads.
  • IJHack/QtPass#1046: Both PRs touch src/storemodel.cpp drag-and-drop MIME handling and format checks.
  • IJHack/QtPass#1066: Both PRs modify StoreModel drag-and-drop code paths and related payload parsing.

Suggested labels

size:S

Poem

A rabbit hops through MIME types with care,
Swapping + for . with nimble flair,
Dragging payloads now glide in a line,
Tests and code agree — everything's fine! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: renaming a malformed MIME type to comply with RFC 6838 standards.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/storemodel-mime-type-rfc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/auto/model/tst_storemodel.cpp`:
- Around line 104-105: Replace the bare QVERIFY(...) MIME-type existence checks
in tst_storemodel.cpp with QVERIFY2(...) so failures provide descriptive
messages: locate the assertions that call
QVERIFY(types.contains("application/vnd.qtpass.dragAndDropInfoPasswordStore"))
(and the similar one around lines 222-223) and change them to
QVERIFY2(types.contains(...), "<descriptive failure message indicating which
MIME type was expected and the actual contents>")—ensure each message names the
expected MIME string (e.g., "expected
application/vnd.qtpass.dragAndDropInfoPasswordStore in types") so test failures
are diagnosable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 468ab27c-f227-436c-9ab1-3df10589f011

📥 Commits

Reviewing files that changed from the base of the PR and between f0361c2 and 531bd95.

📒 Files selected for processing (2)
  • src/storemodel.cpp
  • tests/auto/model/tst_storemodel.cpp

Comment thread tests/auto/model/tst_storemodel.cpp Outdated
CodeRabbit nit on #1468 follow-up: bare QVERIFY() on the
mimeTypes()/mimeData() assertions doesn't say which MIME string was
expected if the test fails. Switch to QVERIFY2 with descriptive
messages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

coveralls commented May 13, 2026

Coverage Status

coverage: 28.988%. remained the same — fix/storemodel-mime-type-rfc into main

@annejan annejan merged commit 18a14de into main May 13, 2026
23 of 25 checks passed
@annejan annejan deleted the fix/storemodel-mime-type-rfc branch May 13, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants