@@ -360,23 +360,27 @@ func UpdateApplication(body []byte, clientIP string, authUser *models.AuthUser)
360
360
return nil , err
361
361
}
362
362
app := rpcAppRequest .Object
363
+ // backup app0 to update destinations and domains
364
+ var app0 * models.Application
363
365
customHeaders := GetCustomHeadersString (app .CustomHeaders )
364
366
if app .ID == 0 {
365
367
// new application
366
368
app .ID = data .DAL .InsertApplication (app .Name , app .InternalScheme , app .RedirectHTTPS , app .HSTSEnabled , app .WAFEnabled , app .ShieldEnabled , app .ClientIPMethod , app .Description , app .OAuthRequired , app .SessionSeconds , app .Owner , app .CSPEnabled , app .CSP , app .CacheEnabled , customHeaders )
367
369
Apps = append (Apps , app )
370
+ app0 = app
368
371
go utils .OperationLog (clientIP , authUser .Username , "Add Application" , app .Name )
369
372
} else {
370
373
err := data .DAL .UpdateApplication (app .Name , app .InternalScheme , app .RedirectHTTPS , app .HSTSEnabled , app .WAFEnabled , app .ShieldEnabled , app .ClientIPMethod , app .Description , app .OAuthRequired , app .SessionSeconds , app .Owner , app .CSPEnabled , app .CSP , app .CacheEnabled , customHeaders , app .ID )
371
374
if err != nil {
372
375
utils .DebugPrintln ("UpdateApplication" , err )
373
376
}
377
+ app0 , _ = GetApplicationByID (app .ID )
374
378
// update app pointer in apps
375
379
UpdateApplications (app )
376
380
go utils .OperationLog (clientIP , authUser .Username , "Update Application" , app .Name )
377
381
}
378
- UpdateDestinations (app , app .Destinations )
379
- UpdateAppDomains (app , app .Domains )
382
+ UpdateDestinations (app0 , app .Destinations )
383
+ UpdateAppDomains (app0 , app .Domains )
380
384
data .UpdateBackendLastModified ()
381
385
return app , nil
382
386
}
0 commit comments