question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firefox not reporting mime type in Firefox when file is dropped as part of a folder

See original GitHub issue
  • [x ] I found a bug

When I drop a folder which contains an XML file in Firefox (89.0.2) on the Mac (11.4), the type property of the xml file in the array that is handed to acceptedFiles is empty. However, if I drop just that XML file by itself onto the drop target, the type is reported. I’m using the basic example from the docs (below). I haven’t been able to replicate this behavior in other browsers to this point. If I do, I’ll update the ticket.

If I drop just the XML file in the console, I see this: Screen Shot 2021-06-25 at 3 52 37 PM

However, if I drop a folder called myfolder with this structure:

myfolder (root folder)
    - test.xml
    - content (sub folder)
        - orange-lady.png 

…then I see this result: Screen Shot 2021-06-25 at 3 55 03 PM

The png file has a type attached, but test.xml has a blank type. Given that Firefox reports it when it’s dropped by itself, it seems like this is a case of the type not being carried over when react-dropzone processes a folder.

This is the code in its entirety. I’m on react-dropzone 11.3.4 and react 17.0.2

import React from 'react';
import {useDropzone} from 'react-dropzone';

function DropTest(props) {
  const {acceptedFiles, getRootProps, getInputProps} = useDropzone({multiple: true});

  const files = acceptedFiles.map(file => {
    console.log("FILE", file)
    return (
      <li key={file.path}>
      {file.path} - {file.size} bytes
    </li>
    )
  });

  return (
    <section className="container">
      <div {...getRootProps({className: 'dropzone'})}>
        <input {...getInputProps()} />
        <p>Drag 'n' drop some files here, or click to select files</p>
      </div>
      <aside>
        <h4>Files</h4>
        <ul>{files}</ul>
      </aside>
    </section>
  );
}

export default DropTest;

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
rolandjitsucommented, Feb 2, 2022

I can confirm this happens in Firefox. Gonna try to see if it can be fixed.

0reactions
haywirezcommented, Aug 13, 2022

Discovered that this unfortunately also happens in Chrome (104.0.5112.79), not just Firefox 😕 Strangely despite other file drag & drop issues Safari tech preview does have the correct listing behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firefox does not recognize many content types - Mozilla Support
Recently the majority of content types have disappeared from the Applications section in the Settings. (See the attached screenshot) Even ...
Read more >
Manage file types and download actions in Firefox
Learn how Firefox handles files with different content types and how to change what Firefox does when you click on or download a...
Read more >
Firefox reports wrong pdf mime type - Mozilla Support
Chosen solution. Try to delete the mimeTypes. rdf file in the Firefox Profile Folder to reset all file actions. You can also check...
Read more >
Firefox not asking where to download files - Mozilla Support
You need to go into Tools -> Settings -> General and set the Action for the types of downloads to Always Ask for...
Read more >
add file type to download automation | Firefox Support Forum
When Firefox comes across an unknown content type, it typically will ask you how you want to open it, and suggest the program(s)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found