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

XLSXFile fails to open .xlsx file located on iPad ("XLSX file at \(file_path) is corrupted or does not exist") #160

Closed
SeaAddiction opened this issue Apr 26, 2022 · 5 comments
Assignees

Comments

@SeaAddiction
Copy link

SeaAddiction commented Apr 26, 2022

Version
CoreXLSX 0.14.1

Description of the bug
XLSXFile fails to open .xlsx file located on iPad with the path "/private/var/mobile/Containers/Shared/AppGroup/F230537D-AA79-4A0A-AC47-08A1CA3C4BCA/File Provider Storage/workout.xlsx". Resulting in the error "XLSX file at (file_path) is corrupted or does not exist" when executing this code:

guard let file = XLSXFile(filepath: file_path) else {
            fatalError("XLSX file at \(file_path) is corrupted or does not exist")
        }

However, if the same .xlsx file is added to the app bundle, XLSXFile successfully opens the file with the path "/private/var/containers/Bundle/Application/25B45C3E-DF8D-4AB5-9E69-FF761A3DC48A/Phenix Fitt Workout.app/workout.xlsx" when executing the code:

 guard let file = XLSXFile(filepath: file_path) else {
            fatalError("XLSX file at \(file_path) is corrupted or does not exist")
        }

Steps to reproduce
Run the below code with file_path = "/private/var/mobile/Containers/Shared/AppGroup/F230537D-AA79-4A0A-AC47-08A1CA3C4BCA/File Provider Storage/workout.xlsx":

guard let file = XLSXFile(filepath: file_path) else {
            fatalError("XLSX file at \(file_path) is corrupted or does not exist")
        }

Expected behavior
It is expected that XLSXFile will not crash when opening a .xlsx file that is located on the iPad.

File for reproduction
This issue occurs with any .xlsx file.

Additional context

@MaxDesiatov
Copy link
Collaborator

MaxDesiatov commented Apr 26, 2022

Thank you for reporting this. Would you be able to confirm that files at this File Provider Storage can be opened with FileManager APIs before you're trying to initialize XLSXFile?

What does FileManager.fileExists(atPath: "/private/var/mobile/Containers/Shared/AppGroup/F230537D-AA79-4A0A-AC47-08A1CA3C4BCA/File Provider Storage/workout.xlsx") (or for any other path that you're interested in) return for you?

@SeaAddiction
Copy link
Author

SeaAddiction commented Apr 26, 2022 via email

@MaxDesiatov
Copy link
Collaborator

Unfortunately, no, I don't have suggestions as I don't have much experience with the file picker API.

All I can say for now, it doesn't seem to be an issue with CoreXLSX, but rather an issue with the file picker API. Please let me know if your code shows otherwise.

@SeaAddiction
Copy link
Author

SeaAddiction commented Apr 26, 2022 via email

@MaxDesiatov
Copy link
Collaborator

Perfect, thanks for sharing the solution!

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

No branches or pull requests

2 participants