Skip to content

Commit ce76f65

Browse files
YoshihiroItomaxkatz6
authored andcommitted
Fix in HeadlessClipboardStub.GetDataAsync where format is not considered (#18008)
1 parent 0f4055e commit ce76f65

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Headless/Avalonia.Headless/HeadlessPlatformStubs.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,17 @@ public Task<string[]> GetFormatsAsync()
6666

6767
public async Task<object?> GetDataAsync(string format)
6868
{
69-
return await Task.Run(() => _data);
69+
return await Task.Run(() =>
70+
{
71+
if (format == DataFormats.Text)
72+
return _text;
73+
if (format == DataFormats.Files && _data is not null)
74+
return _data.GetFiles();
75+
if (format == DataFormats.FileNames && _data is not null)
76+
return _data.GetFileNames();
77+
else
78+
return (object?)_data;
79+
});
7080
}
7181
}
7282

0 commit comments

Comments
 (0)