DriveBackupV2

DriveBackupV2

46.6k Downloads

Absoulte path error can be incorrect in doSingleBackup

arielbeje opened this issue ยท 0 comments

commented

doSingleBackup checks for any IllegalArgumentException when calling makeBackup, and blames it on the path.

try {
FileUtil.makeBackup(type, format, blackList);
} catch (IllegalArgumentException exception) {
MessageUtil.sendMessageToPlayersWithPermission("Failed to create a backup, path to folder to backup is absolute, expected a relative path", "drivebackup.linkAccounts", Collections.singletonList(initiator), true);
MessageUtil.sendMessageToPlayersWithPermission("An absolute path can overwrite sensitive files, see the " + ChatColor.GOLD + "config.yml " + ChatColor.DARK_AQUA + "for more information", "drivebackup.linkAccounts", Collections.singletonList(initiator), true);

But an IllegalArgumentException can also come from formatting the time (line 82).

public static void makeBackup(String type, String formatString, List<String> blacklistGlobs) throws Exception {
if (type.charAt(0) == File.separatorChar) {
throw new IllegalArgumentException();
}
fileList.clear();
ZonedDateTime now = ZonedDateTime.now(Config.getBackupScheduleTimezone());
String fileName = now.format(DateTimeFormatter.ofPattern(formatString, new Locale(Config.getDateLanguage())));