mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-25 05:39:18 +00:00
prevent overwriting external capture URIs
Closes #4719 fixes #4538 // FREEBIE
This commit is contained in:
committed by
Moxie Marlinspike
parent
bde838d35a
commit
7625ba919e
@@ -97,10 +97,9 @@ public class PersistentBlobProvider {
|
||||
});
|
||||
}
|
||||
|
||||
public Uri createForExternal(@NonNull Recipients recipients) throws IOException {
|
||||
return Uri.fromFile(new File(getExternalDir(context), String.valueOf(generateId(recipients)) + ".jpg"))
|
||||
public Uri createForExternal() throws IOException {
|
||||
return Uri.fromFile(new File(getExternalDir(context), String.valueOf(System.currentTimeMillis()) + ".jpg"))
|
||||
.buildUpon()
|
||||
.appendQueryParameter("unique", String.valueOf(System.currentTimeMillis()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -121,10 +120,6 @@ public class PersistentBlobProvider {
|
||||
: new DecryptingPartInputStream(getFile(id), masterSecret);
|
||||
}
|
||||
|
||||
private int generateId(Recipients recipients) {
|
||||
return Math.abs(Arrays.hashCode(recipients.getIds()));
|
||||
}
|
||||
|
||||
private File getFile(long id) {
|
||||
return new File(context.getDir("captures", Context.MODE_PRIVATE), id + ".jpg");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user