File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Plugins/Flow.Launcher.Plugin.PluginsManager Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ internal async Task InstallOrUpdateAsync(UserPlugin plugin)
145
145
var filePath = Path . Combine ( Path . GetTempPath ( ) , downloadFilename ) ;
146
146
147
147
var downloadCancelled = false ;
148
+ var exceptionHappened = false ;
148
149
try
149
150
{
150
151
if ( ! plugin . IsFromLocalInstallPath )
@@ -168,8 +169,10 @@ await Context.API.ShowProgressBoxAsync(prgBoxTitle,
168
169
{
169
170
if ( reportProgress == null )
170
171
{
171
- // cannot use progress box
172
- await Http . DownloadAsync ( plugin . UrlDownload , filePath ) . ConfigureAwait ( false ) ;
172
+ // when reportProgress is null, it means there is expcetion with the progress box
173
+ // so we record it with exceptionHappened and return so that progress box will close instantly
174
+ exceptionHappened = true ;
175
+ return ;
173
176
}
174
177
else
175
178
{
@@ -200,6 +203,11 @@ await Context.API.ShowProgressBoxAsync(prgBoxTitle,
200
203
cts . Cancel ( ) ;
201
204
downloadCancelled = true ;
202
205
} ) ;
206
+
207
+ // if exception happened while downloading and user does not cancel downloading,
208
+ // we need to redownload the plugin
209
+ if ( exceptionHappened && ( ! downloadCancelled ) )
210
+ await Http . DownloadAsync ( plugin . UrlDownload , filePath ) . ConfigureAwait ( false ) ;
203
211
}
204
212
else
205
213
{
You can’t perform that action at this time.
0 commit comments