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

[Bug]: File uploads in Safari don’t always do work the first time #1313

Closed
1 task done
mommyofavalor opened this issue Jul 8, 2023 · 8 comments · Fixed by #1349
Closed
1 task done

[Bug]: File uploads in Safari don’t always do work the first time #1313

mommyofavalor opened this issue Jul 8, 2023 · 8 comments · Fixed by #1349
Labels
bug Something isn't working

Comments

@mommyofavalor
Copy link

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

A bug happened!

Screen Shot 2023-07-08 at 9 46 00 AM

Every time I try to import transactions there are issues. Sometimes it wants me to double click on the file, sometimes it wants me to click once and press "upload". Sometimes neither of those work and I have to just try multiple times. Then, whenever it finally goes through I get an error message like the one above.

I am hosting on pikapod

What error did you receive?

"possible error importing file"

Where are you hosting Actual?

Other

What browsers are you seeing the problem on?

Safari

Operating System

Mac OSX

@mommyofavalor mommyofavalor added the bug Something isn't working label Jul 8, 2023
@j-f1
Copy link
Contributor

j-f1 commented Jul 8, 2023

Thank you for reporting!

Sometimes it wants me to double click on the file, sometimes it wants me to click once and press "upload".

Both of these should work. The file picker is controlled entirely by the browser, so we don’t have any control over what happens here.

Sometimes neither of those work and I have to just try multiple times.

I’ve seen this happen sometimes too in Safari, but haven’t been able to trace down exactly why it happens.

Then, whenever it finally goes through I get an error message like the one above.

That error message comes from our new OFX parser, which we ultimately decided would be too complicated to update to work properly. The next release (v23.7.1 or v23.7.2), which will hopefully roll out to PikaPods soon, removes the new parser and falls back to our older, more reliable parser. You shouldn’t get those errors anymore after that update. In the meantime, you can ignore the message as it was just intended as a way for us to get feedback about files that broke our new parser (as it turned out, there were a lot!)

I’m going to retitle this issue to focus on the file upload issue since I think that’s the main thing we need to fix here.

@j-f1 j-f1 changed the title [Bug]: New OFX Importer: [Bug]: File uploads in Safari don’t always do work the first time Jul 8, 2023
@mommyofavalor
Copy link
Author

mommyofavalor commented Jul 9, 2023 via email

@Cldfire
Copy link
Contributor

Cldfire commented Jul 15, 2023

++, I'm hitting this as well. I cannot upload a .csv file to import transactions from in Safari 16.5.2. Firefox 115.0.2 on the same laptop has no issues uploading a .csv file and importing transactions.

@j-f1
Copy link
Contributor

j-f1 commented Jul 15, 2023

Give #1345 a shot!

@Cldfire
Copy link
Contributor

Cldfire commented Jul 16, 2023

Poking at this, for whatever reason we don't seem to be hitting the conditional after awaiting the result of the file dialog:

Screen.Recording.2023-07-15.at.11.43.03.PM.mov

@Cldfire
Copy link
Contributor

Cldfire commented Jul 16, 2023

Seems like Safari does not fire the change event listener when a file is selected in the dialog. Check out this codepen: https://codepen.io/udaymanvar/pen/MWaePBY?editors=1111

In Safari nothing is logged to the console after picking a file. In Firefox there are logs.

@Cldfire
Copy link
Contributor

Cldfire commented Jul 16, 2023

I ran monitorEvents(document.body.querySelectorAll("input[type='file']")); in the page console, and all of a sudden import is working fine in Safari and the change event is being fired on the file input.

I'm guessing WebKit doesn't like the fact that the file input is invisible, or something about it.

EDIT: actually, it seems I'm just hitting the behavior mentioned in the original issue. Sometimes it works, sometimes it doesn't.

@Cldfire
Copy link
Contributor

Cldfire commented Jul 16, 2023

Ah hah, inserting the file input into the DOM seems to completely fix the problem in Safari. A simple document.body.appendChild(input) call leads to me being able to reliably import transactions.

I guess WebKit doesn't like file inputs that aren't part of the DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants