amnezia-vpn/amnezia-client

Restoring from backup inserts "garbage" into the servers list

louis-ad opened this issue · 0 comments

Describe the bug
Restoring from backup inserts "garbage" into the servers list, instead of a server description like "ShadowSocks" under the title, I see part of the contents of the backup file, specifically strings that look like the OpenVPN configuration. I can't delete the server from the app either, the only option is to do a full reset.

To Reproduce
Steps to reproduce the behavior:

  1. With a valid configuration that has OpenVPN settings, go to Settings and Backup, Make a Backup file.
  2. Reset the application.
  3. Open the application, "I have the data to connect", "Open config file, key, or QR code".
  4. Select "File with connection settings or backup", and choose the backup file created in step 1.
  5. If you select "Show content", you can see that instead of showing the backup file as a JSON structure, the app has created a new structure, and the contents of the backup file has been inserted as a JSON node inside containers[0].openvpn.last_config.config.
  6. If you go back to the main screen, instead of a server description like "ShadowSocks" under the title, you see part of the contents of the configuration.
  7. Going to Settings Icon (which is only available only after I've setup the app) -> Backup -> Restore from Backup also doesn't bring the expected results.

Expected behavior
Restoring from backup will give me the expected list of servers, and a functioning application.

Smartphone (please complete the following information):

  • Device: Google Pixel 7
  • OS: Android 13
  • Version 4.1.1.0

Server (please complete the following information):

  • OS: Ubuntu 22.04

Additional context
The problem is in ConfigTypes.checkConfigFormat(): if I give it an Amnezia backup file that has an openvpn configuration embedded, it will return ConfigTypes::OpenVpn instead of ConfigTypes::Amnezia.