Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions node/get_status_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,11 @@ func (n *StatusNode) StartLocalBackup() error {
return "", err
}

var backupDir string
if backupPath != "" {
backupDir = backupPath
} else {
backupDir = filepath.Join(n.config.RootDataDir, "backups")
if backupPath == "" {
return "", errors.New("backup path is not set")
}

fullPath := filepath.Join(backupDir, fmt.Sprintf("%s_user_data.bkp", compressedPubKey[len(compressedPubKey)-6:]))
fullPath := filepath.Join(backupPath, fmt.Sprintf("%s_user_data.bkp", compressedPubKey[len(compressedPubKey)-6:]))

return fullPath, nil
}
Expand Down
7 changes: 7 additions & 0 deletions tests-functional/tests/test_local_backup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import os
import re

import pytest

from clients.status_backend import StatusBackend
from resources.constants import Account, user_1
from resources.test_data import profile_showcase_utils
from utils import fake
from clients.api import ApiResponseError

test_one_to_one_chat_id = (
"0x043329fc08727f15c4ec9a17bf7d6a3dc44e9d0d8f782a55804f3660b28827194a365dc1765cf96b6fa5cd666b9ee5298e8ac82f51f7952c4110cbf321d4f63864"
Expand Down Expand Up @@ -194,6 +196,11 @@ def test_local_backup(self, tmp_path):
assert group_chat_recovered, "Group chat was not restored correctly"
assert one_on_one_chat_recovered, "One-to-one chat was not restored correctly"

# Test that it fails if no backupPath is set
backend_client.settings_service.save_setting("backup-path", "")
with pytest.raises(ApiResponseError, match=re.escape("backup path is not set")):
backend_client.api_request_json("PerformLocalBackup", "")

# Change the backup path (Docker restricts access to a lot of folders)
backend_client.settings_service.save_setting("backup-path", "/usr/status-user/backups")

Expand Down