Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled invalid file names #28

Open
KennyDeardorff opened this issue Jun 12, 2020 · 1 comment
Open

Unhandled invalid file names #28

KennyDeardorff opened this issue Jun 12, 2020 · 1 comment

Comments

@KennyDeardorff
Copy link

Description

Somehow, a folder was created in Smartsheet with a carriage return in the folder name. When the backup script tried to create this folder, it threw a CreateFileSystemItemException and stopped scanning for files/folders and moved on to the next user.

Desired behavior

I would like the script to be able to handle this kind of error so that as many sheets are backed up as possible. I think the best solution would be to remove the invalid characters from the file/folder name and continue recursing. Second best option might be to skip that file/folder, but continue with the next sibling/parent folder.

Details

Script version: 1.6.2
Downloading to a Windows file system
continueOnError=true

Call Stack

Note the line break in Folder With<newline>Newline In Name

com.smartsheet.exceptions.CreateFileSystemItemException: C:\Temp\smartsheet-backup\smartsheet-backup\2020-06-11_15_12_57\[[email protected]]\Workspaces\Folder 1\Folder 2\Folder 3\Folder With 
Newline In Name could not be created
	at com.smartsheet.tools.SmartsheetBackupService.createNewFolderQuietly(SmartsheetBackupService.java:322)
	at com.smartsheet.tools.SmartsheetBackupService.createNewFolder(SmartsheetBackupService.java:307)
	at com.smartsheet.tools.SmartsheetBackupService.createFoldersRecursively(SmartsheetBackupService.java:337)
	at com.smartsheet.tools.SmartsheetBackupService.createFoldersRecursively(SmartsheetBackupService.java:346)
	at com.smartsheet.tools.SmartsheetBackupService.createFoldersRecursively(SmartsheetBackupService.java:346)
	at com.smartsheet.tools.SmartsheetBackupService.createFoldersRecursively(SmartsheetBackupService.java:346)
	at com.smartsheet.tools.SmartsheetBackupService.backupTo(SmartsheetBackupService.java:197)
	at com.smartsheet.tools.SmartsheetBackupService.assumeUserAndBackup(SmartsheetBackupService.java:160)
	at com.smartsheet.tools.SmartsheetBackupService.backupOrgTo(SmartsheetBackupService.java:122)
	at com.smartsheet.tools.SmartsheetBackupTool.main(SmartsheetBackupTool.java:107)
@KennyDeardorff
Copy link
Author

It looks like the code is already trying to scrub the file/folder names, but it just wasn't expecting a carriage return/line feed:

public static String scrubName(String fileName) {
return fileName.replaceAll("[\\\\/:\\*?\"<>|]+", "_");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant