Skip to content

Commit b1f5855

Browse files
committed
Small fix for file names when pasting images
1 parent f48df82 commit b1f5855

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

ClipboardCanvas/CanavsPasteModels/ImagePasteModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using ClipboardCanvas.Contexts.Operations;
1717
using ClipboardCanvas.Helpers;
1818
using ClipboardCanvas.Helpers.Filesystem;
19+
using System.IO;
1920

2021
namespace ClipboardCanvas.CanavsPasteModels
2122
{
@@ -90,8 +91,13 @@ protected override async Task<SafeWrapperResult> SetDataFromDataPackage(DataPack
9091
}
9192
else // Just image
9293
{
93-
9494
SafeWrapper<RandomAccessStreamReference> bitmap = await dataPackage.SafeGetBitmapAsync();
95+
SafeWrapper<Uri> uri = await dataPackage.SafeGetUriAsync();
96+
97+
if (uri)
98+
{
99+
customName = Path.GetFileName(uri.Result.LocalPath);
100+
}
95101

96102
if (!bitmap)
97103
{

ClipboardCanvas/Helpers/ClipboardHelpers.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,10 @@ public static async Task<SafeWrapper<RandomAccessStreamReference>> SafeGetBitmap
4747
{
4848
return await SafeWrapperRoutines.SafeWrapAsync(() => dataPackage.GetBitmapAsync().AsTask());
4949
}
50+
51+
public static async Task<SafeWrapper<Uri>> SafeGetUriAsync(this DataPackageView dataPackage)
52+
{
53+
return await SafeWrapperRoutines.SafeWrapAsync(() => dataPackage.GetUriAsync().AsTask());
54+
}
5055
}
5156
}

ClipboardCanvas/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
EntryPoint="$targetentrypoint$">
3333
<uap:VisualElements
3434
DisplayName="Clipboard Canvas"
35-
Description="A tool that helps you be productive, preview multiple files on Infinite Canvas, save storage space with smart Reference Files, and work uninterruptedly with AutoPaste."
35+
Description="A tool that helps you be productive, preview multiple files on Infinite Canvas, save storage space with smart Reference Files, and work uninterruptedly with Autopaste."
3636
BackgroundColor="transparent"
3737
Square150x150Logo="Assets\AppIcon\Square150x150Logo.png"
3838
Square44x44Logo="Assets\AppIcon\Square44x44Logo.png">

0 commit comments

Comments
 (0)