Skip to content

Commit efeb858

Browse files
committed
Fix warning when there's no key file from backend available
1 parent d9494bb commit efeb858

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ For the format to use in `config_local.yml`/`db_location` or the auth backend se
439439
440440
- Log may have 'Key has been revoked' messages: happens when session keyring gets revoked once user (who (re)started the server) logs out. Please file a bug report in this case.
441441
442-
- Tests
442+
- More tests
443443
444444
445445
## SCREENSHOTS

lib/KeePass4Web/Backend/Seafile.pm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ sub _init_repo {
7272

7373
my $seafile = _new;
7474

75-
my $location = _location $get_key;
75+
# return if no key available
76+
my $location = _location $get_key or return;
7677
debug 'Seafile location: ', $location;
7778

7879
my ($repo_id, $dir) = split /\//, $location, 2;
@@ -87,26 +88,28 @@ sub _init_repo {
8788
sub _get {
8889
my ($self, $get_key, %args) = @_;
8990

90-
my ($seafile, $repo_id, $dir) = _init_repo $get_key, \%args;
91+
# return if no key available
92+
my ($seafile, $repo_id, $dir) = _init_repo $get_key, \%args or return;
9193

9294
# get download link
93-
my $db = eval {
95+
my $file = eval {
9496
$seafile->download_file(
9597
'repo-id' => $repo_id,
9698
p => "/$dir",
9799
reuse => 0,
98100
);
99101
};
100102
if ($@) {
103+
my $err = $@;
101104
error $seafile->code, $seafile->error;
102105

103106
debug 'Database URL to download from Seafile: ', $seafile->location;
104107
# clear session token if library decryption expired, so user gets redirected to backend login screen
105108
session SESSION_SF_TOKEN, undef if $seafile->code == BAD_REQUEST;
106-
die $@;
109+
die $err;
107110
}
108111

109-
return $db;
112+
return $file;
110113
}
111114

112115
sub get_key {

0 commit comments

Comments
 (0)