@@ -251,50 +251,58 @@ public async Task<IBackupJob> Execute(bool runCleanUpOnly = false)
251
251
252
252
if ( resultPropExists )
253
253
{
254
- var resultProp = JObject . Parse ( body [ "result" ] . ToString ( ) ) ;
255
-
256
- var mediaId = resultProp [ "mediaFileId" ] . ToString ( ) ;
257
-
258
- var mediaFileName = resultProp [ "fileName" ] . ToString ( ) ;
259
-
260
- backupFileName = mediaId + "/" + mediaFileName ;
261
254
backupCreated = true ;
262
-
263
- Logger . Current . Log ( _logLabel , "Backup file generation complete." ) ;
255
+
256
+ var resultProp = body [ "result" ] ;
257
+
258
+ if ( resultProp != null )
259
+ {
260
+ backupFileName = resultProp . ToString ( ) ;
261
+
262
+ Logger . Current . Log ( _logLabel , "Backup file generation complete." ) ;
263
+ }
264
+ else
265
+ {
266
+ Logger . Current . Log ( _logLabel , "[DEBUG] Result node: " + resultProp ) ;
267
+ Logger . Current . Log ( _logLabel , "Unable to get backup link from the service. You must download it manually!" ) ;
268
+ }
264
269
}
265
270
}
266
271
267
272
System . Threading . Thread . Sleep ( 5000 ) ;
268
273
}
269
274
270
- var backupFileUrl = string . Format ( _service . BaseUrl , Account ) + _service . DownloadUrlBase +
271
- backupFileName ;
272
-
273
- Logger . Current . Log ( _logLabel ,
274
- string . Format ( "Getting generated backup file from {0}" , backupFileUrl ) ) ;
275
- // Download the backup
276
- using ( var fileResponse = await Client . GetAsync ( _service . DownloadUrlBase + backupFileName ,
277
- HttpCompletionOption . ResponseHeadersRead ) )
275
+ if ( ! string . IsNullOrEmpty ( backupFileName ) )
278
276
{
279
- Logger . Current . Log ( _logLabel ,
280
- string . Format ( "Downloading {0} bytes of data..." ,
281
- fileResponse . Content . Headers . ContentLength ) ) ;
277
+ var backupFileUrl = string . Format ( _service . BaseUrl , Account ) + _service . DownloadUrlBase +
278
+ backupFileName ;
282
279
283
- using ( var stream = await fileResponse . Content . ReadAsStreamAsync ( ) )
280
+ Logger . Current . Log ( _logLabel ,
281
+ string . Format ( "Getting generated backup file from {0}" , backupFileUrl ) ) ;
282
+ // Download the backup
283
+ using ( var fileResponse = await Client . GetAsync ( _service . DownloadUrlBase + backupFileName ,
284
+ HttpCompletionOption . ResponseHeadersRead ) )
284
285
{
285
- using ( var outStream =
286
- File . Open (
287
- Path . Combine ( BackupDestination ,
288
- string . Format ( FileName , DateTime . Now . ToString ( "MMddyy" ) ) ) , FileMode . Create ) )
286
+ Logger . Current . Log ( _logLabel ,
287
+ string . Format ( "Downloading {0} bytes of data..." ,
288
+ fileResponse . Content . Headers . ContentLength . ToString ( ) ) ) ;
289
+
290
+ using ( var stream = await fileResponse . Content . ReadAsStreamAsync ( ) )
289
291
{
290
- await stream . CopyToAsync ( outStream ) ;
292
+ using ( var outStream =
293
+ File . Open (
294
+ Path . Combine ( BackupDestination ,
295
+ string . Format ( FileName , DateTime . Now . ToString ( "MMddyy" ) ) ) , FileMode . Create ) )
296
+ {
297
+ await stream . CopyToAsync ( outStream ) ;
298
+ }
291
299
}
292
300
}
293
-
294
- if ( File . Exists ( "backupTaskID" ) )
295
- {
296
- File . Delete ( "backupTaskID" ) ;
297
- }
301
+ }
302
+
303
+ if ( File . Exists ( "backupTaskID" ) )
304
+ {
305
+ File . Delete ( "backupTaskID" ) ;
298
306
}
299
307
300
308
Logger . Current . Log ( _logLabel , "Download complete." ) ;
@@ -329,7 +337,7 @@ private string GetServiceToBeBackedUpLabel()
329
337
330
338
switch ( typeof ( T ) . Name )
331
339
{
332
- case "JIRAService " :
340
+ case "JiraService " :
333
341
serviceToBeBackedUp = "JIRA" ;
334
342
break ;
335
343
case "ConfluenceService" :
0 commit comments