CatimaLoyalty / Android

Catima, a Loyalty Card & Ticket Manager for Android
https://catima.app
GNU General Public License v3.0
818 stars 150 forks source link

Stocard / Klarna APP import failed #2096

Open heximing opened 1 day ago

heximing commented 1 day ago

Google Pixel 6 Android 13 (TQ3A.230901.001.C1) Catima (Google Play) 2.31.1

protect.card_locker.FormatException: Couldn't find any loyalty cards in this Stocard export.

Screenshot_20241002-083235

Stocard is no longer a thing. It will force prompt user to download Klarna APP instead. I contacted support@stocardapp.com to get my export data. I emailed the .zip file and password to catima.g9ex3@hackerchick.me Please take a look.

I checked issue #863, #1242, #1277. Maybe Stocard/Klarna (recently) changed the exported .zip structure again, so Catima import failed.

TheLastProject commented 1 day ago

Quick note for those who see this issue: you can work around it by using a computer to extract and re-compress the Stocard zip file


Thanks for the report and the file you sent through email.

I've checked the file and after some testing I figured out that the structure didn't change, but the format changed.

Old files: Zip archive data, at least v1.0 to extract, compression method=store Your file: Zip multi-volume archive data, at least PKZIP v2.50 to extract

I've created a small issue on zip4j but sadly the library hasn't been updated in a year so I fear we may need to switch to a different zip library to fix this (suggestions welcome!).

For now, I'm going to pin this issue to help users affected find this workaround.

heximing commented 1 day ago

Some notes. When re-compress the zip file, make sure to construct it in the same folder structure. i.e. \extracts\(user-ID-strings)\users\(user-ID-strings)\(11 folders)\ Missing any folders (missing \extracts\(user-ID-strings)\users\) will cause import errors in Catima.

Maybe this is something to be improved for Catima; better folder searching.

Thanks very much.

Unessential commented 1 day ago

I would prefer Catima do a few things, 1. explicity tell the users within the app what format/folder structure it is expecting. (I didn't just request my cards but all my personal data) So after some guesswork I decided to come to the github to find out what it was expecting.

  1. I would also prefer and option for catima to just take the "loyalty-cards" and "loyalty-cards-custom-providers" folders directly

and 3. Maybe the zip files weren't password protected before, but they are now. so maybe a dialog box to paste in the password as well?

TheLastProject commented 1 day ago

@Unessential 1. Catima already tells you what it expects: the .zip file that Stocard provides you as export. There is no logical reason for an user to manually modify an export file. There is only one version Stocard provides. If there were multiple versions, Catima should, if possible, autodetect which one it is so users don't have to figure it out.

  1. That causes a lot of complexity that will only benefit people who do unsupported stuff (modifying the export file). I'm not interested in putting more work into support anything but "importing from the official unmodified export format".
  2. Support for password protected exports has existed for years, Catima pops up a dialog box for a password when it needs one.

The issue is simple: Stocard started compressing the .zip files in a way zip4j doesn't understand, causing zip4j to say there are no files and thus making Catima think there are no cards in the zip. Catima should support these new zip files too so users can load newer Stocard exports into Catima without any manual work.

To be extra clear: extracting and re-compressing is a temporary workaround until this issue is fixed, it is by no means what should be the standard way of working. Users should be able to just load in whatever export file is provided by the app they're switching away from and have it work without thinking.

Unessential commented 12 hours ago

Oops. Yeah. Somehow I missed the post between the first one and your pin, and thought the issue was the folder structure rather than the zip format. I think it's because they way you formatted your post in my head it registered as "post content / signature" like you would see in social forums soI ended up subconsciously filtering it out it. (I know github doesn't have signatures, but my brain processed it that way due to the horizontal rule, and change in font size).

In my head I saw, first post that mendtioned sending example zip + passwords + changed structure, your post with workaround to re zip (which made me assume the zip wasn't previously password protected -- since I didn't get a password prompt before the error message) and then a post after suggesting better folder searching.