1
0
Fork 1

Keep the original filename while sending attachment as file

This commit is contained in:
Torsten Flammiger 2023-08-19 13:57:32 +02:00 committed by Arne
parent f11fb2f8ce
commit 102018bbb1

View file

@ -773,17 +773,13 @@ public class FileBackend {
if ("ogg".equals(extension) && type != null && type.startsWith("audio/")) {
extension = "oga";
}
String filename = "Sent" + File.separator + fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4);
try {
setupRelativeFilePath(message, uri, extension);
copyFileToPrivateStorage(mXmppConnectionService.getFileBackend().getFile(message), uri);
final String name = getDisplayNameFromUri(uri);
if (name != null) {
message.getFileParams().setName(name);
}
} catch (final XmppConnectionService.BlockedMediaException e) {
message.setRelativeFilePath(null);
message.setDeleted(true);
String filename = String.format("%s.%s", mXmppConnectionService.getFileBackend().getFile(message).getName(), extension);
setupRelativeFilePath(message, filename, mime);
copyFileToPrivateStorage(mXmppConnectionService.getFileBackend().getFile(message), uri);
final String name = getDisplayNameFromUri(uri);
if (name != null) {
message.getFileParams().setName(name);
}
}