@@ -45,7 +45,7 @@ var AutoUpdate = function (params) {
45
45
self . getLastModInfo ( self . fileURLCheck , function ( lastModInfo ) {
46
46
// This anonymous function is called when the getLastModInfo function completes
47
47
// Now compare the last mod info to see if it needs reloading
48
- if ( ( lastModifiedToken != "" ) && ( ( self . isDateMode && lastModInfo > lastModifiedToken ) || ( ! self . isDateMode && lastModInfo != lastModifiedToken ) ) ) {
48
+ if ( ( lastModifiedToken != "" ) && lastModInfo != null && ( ( self . isDateMode && lastModInfo > lastModifiedToken ) || ( ! self . isDateMode && lastModInfo != lastModifiedToken ) ) ) {
49
49
// GUI needs to be reloaded
50
50
CF . log ( "UPDATE AVAILABLE!" ) ;
51
51
self . lastModInfo = lastModInfo ;
@@ -75,14 +75,17 @@ var AutoUpdate = function (params) {
75
75
// The HTTP response must issue Last-Modified or Etag headers for this to work (not all servers will do this!)
76
76
self . getLastModInfo = function ( fileURL , callback ) {
77
77
if ( ! fileURL || ! callback ) {
78
+ CF . log ( "AUTO UPDATE ERROR: URL and callback function are required." ) ;
78
79
callback ( null ) ;
79
80
}
80
81
CF . request ( fileURL , self . requestMethod , null , function ( status , headers ) {
81
82
if ( status == "405" ) {
82
83
// Try again, using GET method instead, and use GET for all future checks
83
84
CF . log ( self . requestMethod + " mode not supported by server hosting the GUI." ) ;
84
- self . requestMethod = "GET" ;
85
- self . getLastModInfo ( fileURL , callback ) ;
85
+ if ( self . requestMethod != "GET" ) {
86
+ self . requestMethod = "GET" ;
87
+ self . getLastModInfo ( fileURL , callback ) ;
88
+ }
86
89
} else if ( status != "200" ) {
87
90
CF . log ( "AUTO UPDATE ERROR: GUI File URL returned HTTP Code " + status ) ;
88
91
callback ( null ) ;
0 commit comments