File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/BootstrapBlazor/Components/Download Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 33// See the LICENSE file in the project root for more information.
44// Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 55
6+ using System ;
7+
68namespace BootstrapBlazor . Components ;
79
810/// <summary>
@@ -38,13 +40,13 @@ protected virtual async Task DownloadFromStream(DownloadOption option)
3840 throw new InvalidOperationException ( $ "the { nameof ( option . FileStream ) } is null") ;
3941 }
4042
41- #if NET5_0
42- // net 5.0 not support
43- await Task . CompletedTask ;
44- #elif NET6_0_OR_GREATER
43+ if ( string . IsNullOrEmpty ( option . FileName ) )
44+ {
45+ throw new InvalidOperationException ( $ "the { nameof ( option . FileName ) } is null or empty") ;
46+ }
47+
4548 using var streamRef = new DotNetStreamReference ( option . FileStream ) ;
4649 await InvokeVoidAsync ( "downloadFileFromStream" , option . FileName , streamRef ) ;
47- #endif
4850 }
4951
5052 /// <summary>
@@ -59,6 +61,11 @@ protected virtual async Task DownloadFromUrl(DownloadOption option)
5961 throw new InvalidOperationException ( $ "{ nameof ( option . Url ) } not set") ;
6062 }
6163
64+ if ( string . IsNullOrEmpty ( option . FileName ) )
65+ {
66+ throw new InvalidOperationException ( $ "the { nameof ( option . FileName ) } is null or empty") ;
67+ }
68+
6269 await InvokeVoidAsync ( "downloadFileFromUrl" , option . FileName , option . Url ) ;
6370 }
6471
You can’t perform that action at this time.
0 commit comments