Skip to content

Commit d9089d4

Browse files
committed
Check for a dropbox folder by listing it first
https://forum.virtualmin.com/t/dropbox-backup-error/132870
1 parent c765e24 commit d9089d4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: backups-lib.pl

+12-3
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,18 @@ sub backup_domains
498498
&$first_print($files);
499499
next;
500500
}
501-
my ($already) =
502-
grep { lc($_->{'path_display'}) eq lc("/".$server) }
503-
@$files;
501+
my $already;
502+
if ($server) {
503+
# If backing up to a folder, list contents to
504+
# see if it already exists
505+
my $contents = &list_dropbox_files("/".$server);
506+
$already = 1 if (ref($contents));
507+
}
508+
if (!$already) {
509+
# Fall back to listing the parent dir to look
510+
# for the destination folder
511+
($already) = grep { lc($_->{'path_display'}) eq lc("/".$server) } @$files;
512+
}
504513
if (!$already) {
505514
my $err = &create_dropbox_dir("/".$server);
506515
if ($err) {

0 commit comments

Comments
 (0)