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

fix: Fix errors when FileSystemFileEntry is unsupported #1417

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

Pytal
Copy link
Contributor

@Pytal Pytal commented Sep 24, 2024

When reaching the line on Chromium browsers it will throw

According to online docs FileSystemFileEntry should be available on Chrome but is not defined 😵

Signed-off-by: Christopher Ng <chrng8@gmail.com>
@Pytal Pytal added bug Something isn't working 3. to review Waiting for reviews labels Sep 24, 2024
@Pytal Pytal requested review from susnux and artonge September 24, 2024 17:39
@Pytal Pytal self-assigned this Sep 24, 2024
@Pytal Pytal enabled auto-merge September 24, 2024 17:39
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Yes code looks good :)

But I think we have also a problem here in the utils function, see:
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Firefox_support#chrome_deviations_from_the_specification

@Pytal Pytal merged commit 2c83e6a into main Sep 24, 2024
17 checks passed
@Pytal Pytal deleted the fix/unsupported-file-system-file-entry branch September 24, 2024 17:42
@Pytal
Copy link
Contributor Author

Pytal commented Sep 24, 2024

But I think we have also a problem here in the utils function, see: developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Firefox_support#chrome_deviations_from_the_specification

Uncaught ReferenceError: FileEntry is not defined hmm...

@Pytal
Copy link
Contributor Author

Pytal commented Sep 24, 2024

I think FileSystemFileHandle is used in Chrome

@susnux
Copy link
Contributor

susnux commented Sep 24, 2024

I think FileSystemFileHandle is used in Chrome

That is a different API (which is only used by Chrome as all other declined to use that due to security issues).

It seems like chrome does not provide those classes as public access, you still can log a file entry on chrome but the class prototype is not exposed.
So maybe we need to just check properties (isFile / isDirectory to detect which type it is).

@Pytal Pytal mentioned this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants