mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 08:47:46 +00:00
Clean up file name some on save
Rusty Bird points out that we don't want the save action to create files outside the parent or hidden files. // FREEBIE
This commit is contained in:
parent
4c83e2ce10
commit
0a4d1569fb
@ -181,6 +181,8 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
|
||||
fileName = base + "." + extension;
|
||||
}
|
||||
|
||||
fileName = new File(fileName).getName();
|
||||
|
||||
int i = 0;
|
||||
File file = new File(outputDirectory, fileName);
|
||||
|
||||
@ -189,6 +191,10 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
|
||||
file = new File(outputDirectory, fileParts[0] + "-" + (++i) + "." + fileParts[1]);
|
||||
}
|
||||
|
||||
if (file.isHidden()) {
|
||||
throw new IOException("Specified name would not be visible");
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user