Skip to content

Commit d072c31

Browse files
committed
[Core] Fixed Filename for Uploading the file
1 parent 2704101 commit d072c31

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lagrange.Core/Internal/Packets/Service/NTV2RichMedia.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ private static FileInfo BuildFileInfo(RichMediaEntityBase entity)
121121
info.Type = new FileType { Type = 2, PicFormat = (uint)type };
122122
info.Width = (uint)size.X;
123123
info.Height = (uint)size.Y;
124+
info.FileName = $"{md5}.{type switch
125+
{
126+
ImageFormat.Jpeg => "jpg",
127+
ImageFormat.Png => "png",
128+
ImageFormat.Gif => "gif",
129+
ImageFormat.Bmp => "bmp",
130+
_ => "unknown"
131+
}}";
124132
break;
125133
}
126134
case RecordEntity:
@@ -138,11 +146,19 @@ private static FileInfo BuildFileInfo(RichMediaEntityBase entity)
138146
AudioFormat.SilkV3 => (uint)AudioHelper.GetSilkTime(payload),
139147
_ => 0
140148
};
149+
info.FileName = $"{md5}.{type switch
150+
{
151+
AudioFormat.TenSilkV3 => "silk",
152+
AudioFormat.SilkV3 => "silk",
153+
AudioFormat.Mp3 => "mp3",
154+
_ => "unknown"
155+
}}";
141156
break;
142157
}
143158
case VideoEntity:
144159
{
145160
info.Type.Type = 2; // unable to determine video type, skip
161+
info.FileName = $"{md5}.mp4"; // default to mp4
146162
break;
147163
}
148164
}

0 commit comments

Comments
 (0)