mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fix send text
PiperOrigin-RevId: 645516517
This commit is contained in:
committed by
Copybara-Service
parent
29099eed43
commit
8ba443c7dc
@@ -746,7 +746,7 @@ void NearbySharingServiceImpl::SendAttachments(
|
||||
}
|
||||
for (const FileAttachment& attachment :
|
||||
attachment_container->GetFileAttachments()) {
|
||||
if (!attachment.file_path()) {
|
||||
if (!attachment.file_path() || attachment.file_path()->empty()) {
|
||||
NL_LOG(WARNING) << __func__ << ": Got file attachment without path";
|
||||
std::move(status_codes_callback)(StatusCodes::kInvalidArgument);
|
||||
return;
|
||||
|
||||
@@ -3621,6 +3621,18 @@ TEST_P(NearbySharingServiceImplSendFailureTest, SendTextRemoteFailure) {
|
||||
UnregisterSendSurface(&transfer_callback);
|
||||
}
|
||||
|
||||
TEST_F(NearbySharingServiceImplTest, SendFileWithEmptyPath) {
|
||||
MockTransferUpdateCallback transfer_callback;
|
||||
MockShareTargetDiscoveredCallback discovery_callback;
|
||||
int64_t target_id =
|
||||
DiscoverShareTarget(transfer_callback, discovery_callback);
|
||||
|
||||
EXPECT_EQ(SendAttachments(target_id, CreateFileAttachments({""})),
|
||||
NearbySharingServiceImpl::StatusCodes::kInvalidArgument);
|
||||
|
||||
UnregisterSendSurface(&transfer_callback);
|
||||
}
|
||||
|
||||
TEST_P(NearbySharingServiceImplSendFailureTest, SendFilesRemoteFailure) {
|
||||
MockTransferUpdateCallback transfer_callback;
|
||||
MockShareTargetDiscoveredCallback discovery_callback;
|
||||
|
||||
Reference in New Issue
Block a user