Skip to content

Commit 67d4b2a

Browse files
authored
fix(CardUpload): add duplicate filter logic (#7430)
* fix(CardUpload): 增加去重逻辑 * refactor: 代码格式化
1 parent 6a17658 commit 67d4b2a

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/BootstrapBlazor/Components/Upload/DropUpload.razor

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@namespace BootstrapBlazor.Components
1+
@namespace BootstrapBlazor.Components
22
@inherits FileListUploadBase<string>
33

44
@if (IsShowLabel)
@@ -51,7 +51,8 @@
5151
@if (ShowUploadFileList)
5252
{
5353
<UploadPreviewList Items="Files" IsDisabled="@IsDisabled" ShowProgress="@ShowProgress"
54-
OnGetFileFormat="@OnGetFileFormat" OnCancel="OnCancel" CancelIcon="@CancelIcon" LoadingIcon="@LoadingIcon"
54+
OnGetFileFormat="@OnGetFileFormat" OnCancel="OnCancel"
55+
CancelIcon="@CancelIcon" LoadingIcon="@LoadingIcon"
5556
InvalidStatusIcon="@InvalidStatusIcon" ValidStatusIcon="@ValidStatusIcon"
5657
ShowDownloadButton="@ShowDownloadButton" DownloadIcon="@DownloadIcon" OnDownload="@OnDownload"
5758
DeleteIcon="@DeleteIcon" OnDelete="@OnFileDelete">

src/BootstrapBlazor/Components/Upload/UploadBase.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the Apache 2.0 License
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
@@ -283,7 +283,13 @@ protected List<UploadFile> GetUploadFiles()
283283
{
284284
_filesCache.AddRange(DefaultFileList);
285285
}
286-
_filesCache.AddRange(UploadFiles);
286+
UploadFiles.ForEach(f =>
287+
{
288+
if (!_filesCache.Contains(f))
289+
{
290+
_filesCache.Add(f);
291+
}
292+
});
287293
}
288294
return _filesCache;
289295
}

0 commit comments

Comments
 (0)