Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a file via legacy-API throws AbortError #36

Closed
dwelle opened this issue Mar 4, 2021 · 1 comment · Fixed by #37
Closed

Opening a file via legacy-API throws AbortError #36

dwelle opened this issue Mar 4, 2021 · 1 comment · Fixed by #37

Comments

@dwelle
Copy link
Contributor

dwelle commented Mar 4, 2021

Steps:

  1. in Firefox, open a file that has no extension
  2. instead of resolving with the Blob, it throws AbortError

sandbox: https://srzn8.csb.app/

(via excalidraw/excalidraw#3155)

Introduced in 5d8a551

@dwelle dwelle changed the title Opening a file without extension fails on FF (legacy) Opening a file in FF (legacy) throws AbortError Mar 4, 2021
@dwelle
Copy link
Contributor Author

dwelle commented Mar 4, 2021

Can be hack-fixed by running the cancelDetector in a next tick, but I'd still be hesitant to call it a surefire solution:

const cancelDetector = () => {
  window.removeEventListener('focus', cancelDetector);
  requestAnimationFrame(() => {
    requestAnimationFrame(() => {
      if (input.files.length === 0) {
        reject(
          new DOMException('The user aborted a request.', 'AbortError')
        );
      }
    });
  });
};

@dwelle dwelle changed the title Opening a file in FF (legacy) throws AbortError Opening a file via legacy-API throws AbortError Mar 4, 2021
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 a pull request may close this issue.

1 participant