Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Dragging files from zip archives on web could crash when DataTransferItem.webkitGetAsEntry() returned null.

  • Null-safe drop handling

    • Guard against null entries and skip missing items.
    • Fallback to building drop items from getAsFile() when entry metadata is unavailable.
    • Avoid invoking performOperation_web when no items are produced.
  • Shared file mapping

    • Added _fileToWebDropItem helper to unify file-to-drop-item conversion for both entry and fallback paths.

Example:

final item = items[index];
final entry = item.webkitGetAsEntry();
if (entry != null) {
  return _entryToWebDropItem(entry);
}
final file = item.getAsFile();
if (file != null) {
  return _fileToWebDropItem(file, relativePath: null);
}
return Future.value(null);
Original prompt

This section details on the original issue you should resolve

<issue_title>[desktop_drop_web] Dragging file from zip file crashes</issue_title>
<issue_description>## Reproduce Steps

  1. Drag a file from a zip file (windows explorer)
  2. Observer error when releasing.

Expected behavior

No errors

Version (please complete the following information):

  • Flutter Version: master
  • OS: Windows + Chrome
  • plugin: [e.g. desktop_drop: 0.7.0]

Stack trace:

errors.dart:274 Uncaught DartError: Unexpected null value.
    at Object.throw_ [as throw] (errors.dart:274:3)
    at Object.nullCheck (operations.dart:950:18)
    at desktop_drop_web.dart:92:46
    at List.generate (core_patch.dart:377:46)
    at desktop_drop_web.dart:90:24
    at Object._callDartFunctionFast1 (js_allow_interop_patch.dart:224:27)
    at ret (js_allow_interop_patch.dart:84:15)
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 14, 2026 03:06
Co-authored-by: boyan01 <17426470+boyan01@users.noreply.github.com>
Co-authored-by: boyan01 <17426470+boyan01@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix crash when dragging file from zip on desktop drop Handle nullable drag entries in desktop_drop web to avoid zip-drag crashes Jan 14, 2026
Copilot AI requested a review from boyan01 January 14, 2026 03:10
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.

[desktop_drop_web] Dragging file from zip file crashes

2 participants