Handle special characters in file names
This commit is contained in:
parent
f186dbd0cb
commit
37e4c0a105
@ -400,7 +400,6 @@ class AIRAService : Service() {
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
||||
}
|
||||
notificationManager.notify(notificationIdManager.getMessageNotificationId(sessionId), notificationBuilder.build())
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package sushi.hardcore.aira.background_service
|
||||
|
||||
import sushi.hardcore.aira.widgets.Avatar
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
class Protocol {
|
||||
@ -38,15 +37,17 @@ class Protocol {
|
||||
}
|
||||
|
||||
fun newFile(fileName: String, buffer: ByteArray): ByteArray {
|
||||
return byteArrayOf(FILE)+ByteBuffer.allocate(2).putShort(fileName.length.toShort()).array()+fileName.toByteArray()+buffer
|
||||
val fileNameBytes = fileName.toByteArray()
|
||||
return byteArrayOf(FILE)+ByteBuffer.allocate(2).putShort(fileNameBytes.size.toShort()).array()+fileNameBytes+buffer
|
||||
}
|
||||
|
||||
fun askLargeFiles(files: List<SendFile>): ByteArray {
|
||||
var buff = byteArrayOf(ASK_LARGE_FILES)
|
||||
for (file in files) {
|
||||
val fileName = file.fileName.toByteArray()
|
||||
buff += ByteBuffer.allocate(8).putLong(file.fileSize).array()
|
||||
buff += ByteBuffer.allocate(2).putShort(file.fileName.length.toShort()).array()
|
||||
buff += file.fileName.toByteArray()
|
||||
buff += ByteBuffer.allocate(2).putShort(fileName.size.toShort()).array()
|
||||
buff += fileName
|
||||
}
|
||||
return buff
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user